The Configuration Process for a New Ubuntu Machine
Some Chinese Specific Configurations
-
Setup some VPN software
-
Change the
apt-get
source to Ali source (阿里源): Ref. -
Change the
pip
andconda
source to Tsinghua source (清华源): Ref.conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ conda config --set show_channel_urls yes conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/ # msys2 conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/ # bioconda conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/ # menpo conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo/ # pytorch conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
-
Configure
git
download via VPN
I. Hardware Configurations
- Configure the wifi adapter:
- If you want to use PCIe or USB wifi adapter, please check whether they have drivers in the linux system. I am using TP-Link AC1300 PCIe Wireless Wifi PCIe Card.
- You can refer to this page, which provides an excellent introduction to how to configure adapter drivers. The PCIe card mentioned above is correspond to
14e4:4360
type in the post, where you can usesudo apt install bcmwl-kernel-source
to install the driver. - You can connect your phone to the computer using a USB caple and enable its hotspot functionality. Then your computer can connect to the network via your phont’s hotspot.
- Configure Nvidia Driver
- **The video cable must be plugged into the slots on video cards rather than those on motherboards. **
- Install the
CUDA Toolkit
according to this page (Remember to check cuda version on the tutorial page):- You should choose the appropriate CUDA version according to your demand. (For example, till now (Jan 2019), most TensorFlow versions only support CUDA 9.0 but not 10.0.)
- You can choose to install the required Nvidia driver during this process.
- There maybe some problems herein. I find the following two links very useful to solve the problems.
-
Don’t forget the change add the cuda path to the
PATH
variable. - If you encounter the purple-screen problem:
- Firstly Check the video cable slots problem indicated above.
- Next, you can check the BIOS settings. Disable the ` UEFI Secure Boot`.
- There are other possible causes and solutions. Please try to google
Ubuntu purple screen Nvidia
and find different approaches. This is the hardest part, and it usually takes tons of time to debug. Don’t frustrate and cheer up!
- Download
cuDNN
Runtime Library for your OS on this page and check the corresponding tutorial. (You may set up a new account to download it. )- Run
sudo dpkg -i /path/to/deb/file
andsudo apt-get install -f
to install the deb file. - Why running the
sudo apt-get install -f
command? Ref
- Run
- Setup SSH
-
Install OpenSSH Service
sudo apt-get install openssh-server sudo service ssh status
-
Copy the ssh key to the server
cat ~/.ssh/id_rsa.pub | ssh username@remote_host "mkdir -p ~/.ssh && touch ~/.ssh/authorized_keys && chmod -R go= ~/.ssh && cat >> ~/.ssh/authorized_keys"
-
Change the SSH connection to
only allow ssh-keys
- You need to explicitly set
PasswordAuthentication no
in/etc/ssh/sshd_config
to allow only Public Key Authentication. - And restart the sshd service using
service ssh restart
(pre systemd migration) orsystemctl restart sshd.service
. - Ref
- You need to explicitly set
-
*Resolving the EDAS problems:
When encounter the EDAS problems like:
ECDSA host key for 192.168.1.123 has changed and you have requested strict checking.
You can Remove the cached key for 192.168.1.123 on the local machine:ssh-keygen -R 192.168.1.123
-
-
Setup zsh and plugins (include install git)
- Refer to this page for the installation process:
apt-get install zsh apt-get install git-core wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh chsh -s `which zsh` sudo shutdown -r 0
-
Use
echo $0
to check if zsh installation is successful. Ref -
Install zsh plug-ins and change zsh themes. Ref. Use
nano ~/.zshrc
to edit the zsh configuration file. Change the property ofZSH_THEME
andplugins
:ZSH_THEME="agnoster" ... plugins=( git thefuck sudo autojump last-working-dir zsh-syntax-highlighting colored-man-pages pip extract web-search )
- *Change the iterm2 color schema according to this page.
- Refer to this page for the installation process:
- For Windows and Ubuntu dual boot machines, if you cannot boot Ubuntu,
- Check your BIOS configuration and disable
secure boot
. - If
secure boot
is disabled and you still cannot boot the system, it is possibly due to something wrong with the GRUB. - You can use a ubuntu installation disk with
boot-repair
to resolve the issue, ref to https://help.ubuntu.com/community/Boot-Repair and https://blog.csdn.net/qq_34562959/article/details/81095716 .
- Check your BIOS configuration and disable
II. Python Environment Configurations
- Install Anaconda:
- For Chinese users, they can download Anaconda via Tsinghua source with higher speed.
sudo bash ./Anaconda3-xxxx.xx-Linux-x86_64.sh
- Remember to allow anaconda to initialize the
.bashrc
file and copy the settings to.zshrc
file.
- Some tricky issues about Anaconda:
- Install the TensorFlow or PyTorch GPU version based on the instructions on their websites.
conda install pytorch torchvision cuda100 -c pytorch
- Tensorflow Installation. Generally use
pip instal tensorflow-gpu
- Verify the tensorflow installation:
import tensorflow as tf hello = tf.constant("hello TensorFlow!") sess=tf.Session() print(sess.run(hello))
III. Useful Ubuntu Softwares
htop
: An enhanced processor monitorscreen
: As described here, screen is a terminal multiplexer, which allows a user to access multiple separate terminal sessions inside a single terminal window or remote terminal session.wttr.in
: An interesting bash-based weather forcast app by igor_chubin. You can use it viacurl http://wttr.in/<cityname>
.