Problem: Linux box on Windows domain does not allow the user to set the shell with chsh -s /bin/zsh (or whichever shell). There are no errors, it just doesn't work. Using root, nothing happens either, using chsh -s /bin/zsh user.name to set it for the user gives the error user 'user.name' does not exist in /etc/passwd. You could probably go into the passwd file and make it work but a suitable way is to add to .bashrc
export SHELL=/bin/zsh
exec /bin/zsh -l
This redirects the shell to zsh but also allows you to type "exit" to leave the terminal - not just return to bash.
*NOTE: this should also work if the user does not have root access - like on a shared computer
Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts
Thursday, July 28, 2016
OpenFOAM on Domain Computer
Problem: OpenFOAM does not work linux machine added to a Windows domain. When you source OpenFOAM bashrc file, it overwrites the PATH so no terminal commands are recognized (ls, sudo, etc.)
Solution:
cd /opt/openfoam4/etc (or whichever version is installed)
sudo vim bashrc
comment line 153:
# cleaned=`$foamClean "$PATH" "$foamOldDirs"` && PATH="$cleaned"
save and quit (:wq)
For some reason, this line destroys the path when the machine is on the domain. This is not a problem for machines not on a domain.
*NOTE: for zsh shell, there may be an error stating that "-t" flag is not recognized, if so:
sudo vim config.sh/aliases
delete the "-t" from line 73
the line should read:
[ "$(type wmRefresh)" = "alias" ] && unalias wmRefresh || unset wmRefresh
Solution:
cd /opt/openfoam4/etc (or whichever version is installed)
sudo vim bashrc
comment line 153:
# cleaned=`$foamClean "$PATH" "$foamOldDirs"` && PATH="$cleaned"
save and quit (:wq)
For some reason, this line destroys the path when the machine is on the domain. This is not a problem for machines not on a domain.
*NOTE: for zsh shell, there may be an error stating that "-t" flag is not recognized, if so:
sudo vim config.sh/aliases
delete the "-t" from line 73
the line should read:
[ "$(type wmRefresh)" = "alias" ] && unalias wmRefresh || unset wmRefresh
Labels:
Active Directory,
Domain,
Linux,
OpenFOAM
Wednesday, December 30, 2015
My Fresh Linux Install Script
My personal set of software to install and commands to run on a fresh install of Ubuntu
sudo apt-get install gfortran vim git tmux texlive openssh-server libgnome2-bin pandoc gnuplot ffmpeg gimp inkscape emacs zsh htop octave unison
git clone http://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
anaconda python
mendeley
chrome
teamviewer
Thunderbird:
gcontactsync
lightning
provider for google calendar
thunderbird conversations
if there's a problem with the zsh after copying oh_my_zsh from another install rather than downloading from scratch:
zsh compinit: insecure directories, run compaudit for list.
Ignore insecure directories and continue [y] or abort compinit [n]?
sudo chmod -R 755 .oh-my-zsh
fedora 23
sudo dnf install vim-enhanced gcc-gfortran gcc-c++ gimp inkscape tmux texlive libgnome zsh gnome-tweak-tool htop octave unison qtwebkit
to get gnome-open working
libgnome
to get mendeley working
sudo dnf install qtwebkit
add to .tmux.conf
set -g default-shell /bin/zsh
sudo apt-get install gfortran vim git tmux texlive openssh-server libgnome2-bin pandoc gnuplot ffmpeg gimp inkscape emacs zsh htop octave unison
git clone http://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
anaconda python
mendeley
chrome
teamviewer
Thunderbird:
gcontactsync
lightning
provider for google calendar
thunderbird conversations
if there's a problem with the zsh after copying oh_my_zsh from another install rather than downloading from scratch:
zsh compinit: insecure directories, run compaudit for list.
Ignore insecure directories and continue [y] or abort compinit [n]?
sudo chmod -R 755 .oh-my-zsh
fedora 23
sudo dnf install vim-enhanced gcc-gfortran gcc-c++ gimp inkscape tmux texlive libgnome zsh gnome-tweak-tool htop octave unison qtwebkit
to get gnome-open working
libgnome
to get mendeley working
sudo dnf install qtwebkit
add to .tmux.conf
set -g default-shell /bin/zsh
Labels:
Linux
Tuesday, December 29, 2015
Sync Files Between Windows and Linux with Unison
I'd been using GoodSync to synchronize and backup all my important files on windows. I was GoodSync to perform backups both locally and to remote machines. I loved it. It worked perfectly fine when both machines were windows based. Now that I'm at least partially switched to Linux, Goodsync still works, but it's a command line tool that isn't quite as nice as it was before.
First I tried rsync. That required a push and a pull command to get updates propagated both directions. That's fine in one direction but once files get deleted, problems abound since you'd have to know the direction to propagate the deletion to specify the order of the push and pull. I wanted something that could handle things a bit better.
My setup: Linux (Ubuntu) as primary, Windows as remote
First Install ssh on windows. OpenSSH should work fine but for some reason years ago I tried out Bitvise and stuck with it. Either way, should be fine
Now download the binary for windows
http://unison-binaries.inria.fr/
and install unison on Linux
sudo apt-get install unison
make sure you can connect to the windows ssh - port forwarding could be required
ssh username@ipaddress
for those of us without dydns setup
Set up the unison binary:
I used the text version not the gui version.
Extract the zip
copy the executable somewhere (I made a folder C:/Users/UserName/Unison)
Add that folder to the path
System>Advanced Settings>Environmental Variables>Path
(something line ; pathtounisonfolder) (don't forget the semicolon to denote a new entry)
I also renamed the executable to simply "unison.exe" so that I could invoke the keyword "unison" from command prompt. You can check this now.
From Linux make sure unison can be invoked
ssh username@ipaddress unison -version
the result should match
unison -version
if it doesn't see about getting the same version of the software on both local and remote systems.
now setup a synchronization for instance syncing local (linux) dir1 to remote dir4
unison -auto ~/Desktop/dir1 ssh://username@ipaddress/Desktop/dir4
-auto so it doesn't require you to confirm that every single change exists. It will still ask you to confirm before syncing...there's another command to make it just do it.
Lastly, if you need to access other harddrives on the remote machine, it can be done with symbolic links
for instance to make a link to My_Library on D drive ssh into the machine and
mklink /J C:\Users\UserName\Unison\My_Library D:\My_Library
/J for directory link
The first entry is the Location and name of the link and the second is the actual directory
now in unison use
unison -auto ~/media/mountpoint/My_Library ssh://username@ipaddress/Unison/My_Library
ignoring files can be done in the ~/.unison/default.prf file
ignore = Path _gsdata_
ignores my goodsync hidden files from before
that should be it!
https://www.cis.upenn.edu/~bcpierce/unison/download/releases/stable/unison-manual.html#further
First I tried rsync. That required a push and a pull command to get updates propagated both directions. That's fine in one direction but once files get deleted, problems abound since you'd have to know the direction to propagate the deletion to specify the order of the push and pull. I wanted something that could handle things a bit better.
My setup: Linux (Ubuntu) as primary, Windows as remote
First Install ssh on windows. OpenSSH should work fine but for some reason years ago I tried out Bitvise and stuck with it. Either way, should be fine
Now download the binary for windows
http://unison-binaries.inria.fr/
and install unison on Linux
sudo apt-get install unison
make sure you can connect to the windows ssh - port forwarding could be required
ssh username@ipaddress
for those of us without dydns setup
Set up the unison binary:
I used the text version not the gui version.
Extract the zip
copy the executable somewhere (I made a folder C:/Users/UserName/Unison)
Add that folder to the path
System>Advanced Settings>Environmental Variables>Path
(something line ; pathtounisonfolder) (don't forget the semicolon to denote a new entry)
I also renamed the executable to simply "unison.exe" so that I could invoke the keyword "unison" from command prompt. You can check this now.
From Linux make sure unison can be invoked
ssh username@ipaddress unison -version
the result should match
unison -version
if it doesn't see about getting the same version of the software on both local and remote systems.
now setup a synchronization for instance syncing local (linux) dir1 to remote dir4
unison -auto ~/Desktop/dir1 ssh://username@ipaddress/Desktop/dir4
-auto so it doesn't require you to confirm that every single change exists. It will still ask you to confirm before syncing...there's another command to make it just do it.
Lastly, if you need to access other harddrives on the remote machine, it can be done with symbolic links
for instance to make a link to My_Library on D drive ssh into the machine and
mklink /J C:\Users\UserName\Unison\My_Library D:\My_Library
/J for directory link
The first entry is the Location and name of the link and the second is the actual directory
now in unison use
unison -auto ~/media/mountpoint/My_Library ssh://username@ipaddress/Unison/My_Library
ignoring files can be done in the ~/.unison/default.prf file
ignore = Path _gsdata_
ignores my goodsync hidden files from before
that should be it!
https://www.cis.upenn.edu/~bcpierce/unison/download/releases/stable/unison-manual.html#further
Wednesday, November 4, 2015
My tmux.conf file
I took this from a couple places namely
http://tangledhelix.com/blog/2012/07/16/tmux-and-mouse-mode/
https://unwiredcouch.com/2013/11/15/my-tmux-setup.html
https://wiki.archlinux.org/index.php/Tmux
very helpful
# Change prefix to C-s
unbind C-b
set -g prefix C-s
bind C-s send-prefix
# force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf
# start window numbering at 1 for easier switching
set -g base-index 1
# colors
set -g default-terminal "screen-256color"
# unicode
setw -g utf8 on
set -g status-utf8 on
# status bar config
set -g status-left "#h:[#S]"
set -g status-left-length 50
set -g status-right-length 50
set -g status-right "⚡ #(~/bin/tmux-battery) [✉#(~/bin/imap_check.py)] %H:%M %d-%h-%Y"
setw -g window-status-current-format "|#I:#W|"
set-window-option -g automatic-rename off
# listen to alerts from all windows
set -g bell-action any
# rebind pane tiling
bind V split-window -h
bind H split-window
# quick pane cycling
unbind ^A
bind ^A select-pane -t :.+
# screen like window toggling
bind Tab last-window
bind Escape copy-mode
# vim movement bindings
set-window-option -g mode-keys vi
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Enable mouse scrolling
#set-window-option -g mode-mouse on
set -g mode-mouse on
set -g mouse-resize-pane on
set -g mouse-select-pane on
set -g mouse-select-window on
http://tangledhelix.com/blog/2012/07/16/tmux-and-mouse-mode/
https://unwiredcouch.com/2013/11/15/my-tmux-setup.html
https://wiki.archlinux.org/index.php/Tmux
very helpful
# Change prefix to C-s
unbind C-b
set -g prefix C-s
bind C-s send-prefix
# force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf
# start window numbering at 1 for easier switching
set -g base-index 1
# colors
set -g default-terminal "screen-256color"
# unicode
setw -g utf8 on
set -g status-utf8 on
# status bar config
set -g status-left "#h:[#S]"
set -g status-left-length 50
set -g status-right-length 50
set -g status-right "⚡ #(~/bin/tmux-battery) [✉#(~/bin/imap_check.py)] %H:%M %d-%h-%Y"
setw -g window-status-current-format "|#I:#W|"
set-window-option -g automatic-rename off
# listen to alerts from all windows
set -g bell-action any
# rebind pane tiling
bind V split-window -h
bind H split-window
# quick pane cycling
unbind ^A
bind ^A select-pane -t :.+
# screen like window toggling
bind Tab last-window
bind Escape copy-mode
# vim movement bindings
set-window-option -g mode-keys vi
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Enable mouse scrolling
#set-window-option -g mode-mouse on
set -g mode-mouse on
set -g mouse-resize-pane on
set -g mouse-select-pane on
set -g mouse-select-window on
Labels:
Linux,
Programming
Tuesday, March 1, 2011
Sage Server Through VMware
Sage is a open source frontend and server that I use to replace Mathematica in particular, but will also serve as a frontend for Mathematica, Matlab, Latex, Python (it's foundation), and more. It is almost powerful enough to completely replace Mathematica as an analytic mathematics software. It's really close. It surpasses Mathematica in the ease and speed in which you can do real coding for numerical mathematics as well. It uses Python, numpy and scipy so all the standard Matlab stuff is included. It spits out really nice figures too. The server side is one of the best parts! Documentation is kinda poor to get the install right but once you do, it will automatically store accounts and log in information for multiple simultaneous users. It's browser based, so you never have to install anything on your personal machine and it just so convenient!
Enough about that! The biggest problem - poor documentation for the novice since it doesn't have a Windows version. It has a virtual machine version and ok documentation to install with Windows as the host but screw that! If you're a research group or company, I would forgo all the VMware stuff I'm including here and just build a dedicated Linux server. You'll get more performance, less set up, and you can use it to run all kinds of other code scripts so each client machine doesn't have to have all that garbage installed.
I had help setting my instance from this document. I did things a little differently and that's why i'm posting about it now.
- Install VMware. Get VMware. We had a copy of VMware Workstation that was unused so I know it works. Virtual Box probably works too.
- Install Linux on VMware. I installed Ubuntu x64. Overall, Ubuntu is the least foreign to my simple Windows using mind;). File-New-Virtual Machine-Install from iso-follow the onscreen directions
- If this is a VMware install, I assume this is a test bed and not a full implementation. If this is true, select the amount of RAM and Disk Space you want to allocate in the OS settings through VMware. The Network Adapter should be set to Bridged: Connect directly to the physical network. The checkbox "Replicate physical ..." is unchecked. This step is important for assigning a unique IP address to the Virtual Machine so it can be accessed directly and not just through the host.
- Install an ssh server. Sage is a command line software (so is Mathematica, Matlab, Python...etc) with a frontend attached. Command line access through ssh can be helpful if you want to remotely run code...any code...not just sage...so I recommend doing this regardless of what you plan on putting on your server. Do this with sudo apt-get install openssh-server
- Download Sage from sagemath.org. Make sure you get the right version for your operating system.
- Install. I never remember how to install anything in Linux...I can't understand why Linux operating system designers make it so damn complicated. I think the correct install command for sage is sudo ./
but it might simply be sudo ./sage ...I don't really remember but I think it actually just extracts somewhere and is done so you might want to make sure the install file is already in the folder you want the final install in...I just can't remember. It might actually have a debain package that "just works" when you double click it. - Test to make sure it installed. open terminal and type the word "sage" you should get a sage: prompt. If you type notebook() a web browser should pop up with the generic server index page. More specifically type notebook(address='
',port=8000,accounts=True) to start a server on that ip with that port and user accounts enabled. - To really make this a server, it is convenient to set up some symbolic links. Enter (from the document linked above)
cd
ln -s sage
cd /usr/local/bin
sudo ln -s /sage sage
sudo ln -s /local/bin/sage-python sage-python
cd
Here, is the full path to the Sage directory, something
like:
/home//sage-3.2.1-etc...
To test the links, go to your home directory and type:
sage
This should start Sage. Then enter:
sage-python
This will start the version of Python that comes with Sage.
- Now we want a script to start the server with all the options already set. I'm not sure if it has to be a Python script but Python plays nice with Linux and that's a good thing. In the home directory make a file called notebook.py with the following commands inside
notebook(address='XXX.XXX.XX.XXX',port=8000,accounts=True)
all the Xs are for the IP address of the virtual machine. make sure the apostrophes are included. accounts=True allow for private user accounts to be created on the server. When you run this script terminal will give an error about being crazy if you don't have secure=True but True seems to disallow access over the internet.
- Start the server with sage-python notebook.py
- Make a launcher from the desktop. I think there is a way to have the server start with the machine but I'm to dumb to use Linux. My small brain can only hand simple Windows and the super convenient Startup folder. If you're like me, right click on the desktop and create launcher. It's either type: application or application in terminal. I don't remember. and the command: sage-python notebook.py
- THIS STEP PROBABLY ISN'T NEEDED FOR BRIDGED NETWORK ADAPTERS. From Windows go to Allow program through firewall and open port 8000 in UDP and TDP.
- The server can now be accessed through any web browser by typing http://XXX.XXX.XX.XXX:8000 or by pointing any ssh client to the same address
Labels:
Linux,
Programming,
Sage
Subscribe to:
Posts (Atom)