ArchLinux+deepin desktop+NVIDIA+CUDA+CUDNN installation
1 Introduction
Arch Linux uses a rolling release model to obtain the latest version of system updates and software. Thanks to a higher personalized system, recently used archlinux to configure some basic compilation environments for their own use. Of course, unfamiliar students can also use the Manjaro Linux desktop environment to install the basic operating system. This article will detail how to configure the archlinux deep learning environment.
2. Installation of ArchLinux Base system
Generally, the installation of archlinux is divided into the following basic parts: network configuration (used to download files and update the system), partition, installation system, environment configuration, and launcher configuration.
2.1 Network configuration
Turn on dhcp, connect to the wireless network
systemctl start dhcpcd
wifi-menu # 开启wifi
Of course, you can use a wired network to plug in the network cable directly.
Update system time
This step is used to calibrate the system time information
timedatactl set-ntp true
Edit mirror site files The
mirror site files have too many foreign URLs, and the internet speed is slow. Here, we use domestic websites to speed up downloading.
mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.back
cat /etc/pacman.d/mirrorlist.back |grep China -A -v '-'>/etc/pacman.d/mirrorlist
Or edit the /etc/pacman.conf file,
nano /etc/pacman.conf
If there is no nano editor, you can download it directly
pacman -S nano
And add the following
[archlinuxcn]
Server = https://mirrors.tuna.tsinghua.edu.cn/archlinuxcn/$arch
After saving, update the source
pacman -Syy
2.2 Partition
Use fdisk, gparted, and cfdisk to perform partition operations. Unfamiliar friends can use cfdisk to partition the disk, which is suitable for unskilled friends.
View partition status
fdisk -l
According to the state of the partition, you can determine how you install it. Of course, it is possible to deploy each folder in the root directory of Linux to a different partition, which requires reasonable use of the partition. The author allocated 30GB for archlinux, 300MB for EFI boot, and 2GB for swap partition.
Format partition
mkfs.fat /dev/sda1 # 用于EFI启动的分区
mkfs.ext4 /dev/sdaX # 用于安装系统文件的位置
swapon /dev/sdaX # 激活交换分区
Mount partition
mount /dev/sdaX /mnt # 用于安装文件系统
mkdir -p /mnt/boot/efi
mount /dev/sda1 /mnt/boot/efi #用于安装EFI启动器
So the second step is completed
2.3 Install the basic system and environment configuration
Install the basic system
Use the following command to install the basic system from source
pacstrap -i /mnt base base-devel linux linux-firmware
The first two are to install the basic system, the latter is the linux kernel and linux firmware. This takes a while.
After the installation is complete, perform basic configuration
configuration fstab
genfstab -U /mnt >> /mnt/etc/fstab
Better check again
cat /mnt/etc/fstab
Switch root
Use chroot to switch to the new system
arch-chroot /mnt /bin/bash
Install editor and more
pacman -Sy
pacman -S nano
Local language configuration
nano /etc/locale.gen
Delete the following content in this file
en_US.UTF-8 UTF-8
zh_CN.UTF-8 UTF-8
Generate the corresponding language configuration file
locale-gen
Set the system language (English is recommended)
echo LANG=en_US.UTF-8 > /etc/locale.conf
Set time zone to
generate soft link
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
Set hardware time
hwclock --systohc --utc
hwclock --systohc --localtime
Set hostname
echo myhostname > /etc/hostname
Where myhostname is the host name you set yourself. Or you can use nano to open the hostname file, edit and save it.
Edit the /etc/hosts file,
nano /etc/hosts
Then write the following in the file
127.0.0.1 localhost.localdomain localhost
::1 localhost.localdomain localhost
127.0.1.1 myhostname.localdomain myhostname
Where myhostname is the host name defined by yourself.
User management
First set the root password
passwd root
Then add users
useradd -m -g users -G wheel -s /bin/bash myusername
Set user password
passwd myusername
Where myusername is the user name set.
Add the user to sudo
nano /etc/sudoers
Find root ALL=(ALL)ALL, then add content
myusername ALL=(ALL)ALL
Network configuration
Start network connection at boot
systemctl enable dhcpcd
Set up a wireless network connection
pacman -S net-tools iw wpa_supplicant dialog
This basically sets up the system configuration
2.4 Installation of system launcher
The system launcher is divided into two situations, one is the basic BIOS+MBR startup method, download and install the basic launcher
pacman -S grub-bios
installation
grub-install --target=i386-pc --debug --force /dev/sdaX
The other is the UEFI+GPT boot method, because the author uses this boot method in the notebook
pacman -S grub efibootmgr os-prober dosfstools
installation
grub-install --target=x86_64-efi --efi-directory=/boot/efi --recheck
Generate the corresponding configuration file
grub-mkconfig -o /boot/grub/grub.cfg
In this way, the launcher is installed.
Based on the above steps, the basic environment is installed successfully. Then exit the chroot and restart the operating system.
exit
umount -R /mnt
reboot
3. NVIDIA graphics driver installation
After restarting the system, you can log in to enter the system, and then start to install the graphics card driver. Here first look at what the basic graphics card driver is
lspci |grep VGA
There are the following installations of the graphics card driver
Package name | use |
---|---|
xf86-video-vesa | Universal |
xf86-video-intel | intel nuclear display |
xf86-video-new | nvidia |
xf86-video-ati | ATi |
The above different installation package files can be used for different computers. I use a GeForce graphics card in my computer. I need to disable this graphics card driver after installing xf86-video-nouveau, so I didn’t install this driver. After searching using the pacman package name, I found the corresponding nvidia graphics card driver package, so I’m here Direct installation
pacman -S nvidia
This will install the nvidia graphics driver.
Install X service
sudo pacman -S xorg-server xorg-init
Install the touchpad driver (ignored by the desktop)
sudo pacman -S xf86-input-synaptics
Install font files
sudo pacman -S ttf-dejavu wqy-microhei
Install the sound card driver
sudo pacman -S alsa-utils
sudo pacman -Sy alsa-lib alsa-utils
sudo systemctl --user enable pulseaudio # 设置开机启动
or it could be
systemctl start alsa-state.service
systemctl enable alsa-state.service
This completes the underlying display service, and the next step is to install the corresponding desktop environment.
4. Installation of Desktop Environment
There are many kinds of desktop environment installations, including Gonme desktop, KDE desktop, XFace desktop, LXDE desktop, deepin desktop, Pantheon desktop, Unity desktop, etc. Based on the love of deepin desktop environment and usage habits, I decided to use deepin desktop environment. In addition, the author also lists the installation process of other desktop environments.
4.1 deepin desktop
The deepin desktop comes from the Deepin Technology desktop, which is loved by many people because of its gorgeous desktop. Install the basic environment
sudo pacman -S deepin deepin-extra lightdm lightdm-deepin-greeter
Install network manager
sudo pacman -S networkmanager
Boot up NetworkManager and lightdm
sudo systemctl enable NetworkManager
sudo systemctl enable lightdm
After setting up, you can enter the desktop environment after restarting, and you can set the desktop configuration accordingly.
4.2 Gnome desktop
Install the corresponding desktop environment
sudo pacman -S gnome gnome-tweak-tool alacarte
Among the above commands, the first item is the basic desktop environment, the second item is the gnome desktop optimization tool, and the third is the gnome desktop menu editor.
Start the gnome desktop window manager service and network management service
sudo systemctl enable gdm
sudo systemctl enable NetworkManager
Just restart
4.3 KDE Desktop
Install the corresponding desktop environment
sudo pacman -S plasma konsole dolphin kde-applications
Among the above commands, the first item is the basic desktop environment, the second item is the konsole terminal, the third item is the plasma manager, and the fourth item is the KDE suite, which includes many commonly used system tools and so on.
Start sddm desktop window manager service and network management service
sudo systemctl enable sddm
sudo systemctl enable NetworkManager
Install front-end tools for network management
sudo pacman -S plasma-nm
Just restart
4.4 XFace4 desktop
Install desktop environment and lightdm desktop manager
sudo pacman -S xfce4 xfce4-goodies lightdm lightdm-gtk-greeter
Start the desktop environment
sudo systemctl start lightdm.service
Boot lightdm service and network management service
sudo systemctl enable lightdm
sudo systemctl enable NetworkManager
4.5 LXDE Desktop
Install the corresponding desktop environment
sudo pacman -S lxde-common lxsession lxpanel openbox lxterminal pcmanfm
The corresponding ones are LXDE desktop environment, LXDE Session, LXDE panel, LXDE window manager, terminal under LXDE environment, file manager and
then start the corresponding service.
sudo systemctl enable lxsession
sudo systemctl enable NetworkManager
The installation of other desktops is similar to the above, for example, the installation of UKUI desktop (domestic Kylin system desktop, Galaxy Kylin desktop):
sudo pacman -S ukui
Finally, the installation process of Pantheon desktop, Cinnamon desktop, MATE desktop, Budgie desktop, etc. is similar, so I won’t describe it here.
5. CUDA+CUDNN environment installation
After the above installation process, use the following command to view the graphics driver of the system
nvidia-smi
The arclinux official website shows that there are CUDA and CUDNN driver environments in its open source, which can be installed directly using pacman:
sudo pacman -S cuda cudnn
For detailed information, please refer to ArchCuda .
6. Follow-up process of installation
6.1 Add domestic sources
Edit file
nano /etc/pacman.conf
You can add 163 website mirror source or Tsinghua mirror source, etc. The author uses Tsinghua mirror source:
[archlinuxcn]
Server = https://mirrors.tuna.tsinghua.edu.cn/archlinuxcn/$arch
Or use the following method to switch the Chinese mirror source
sudo pacman-mirrors --country China
Then update and select the fastest source list
sudo pacman-mirrors -g
Update system
sudo pacman -Sy
sudo pacman -Syy
sudo pacman -Syyu
Then install the archlinuxcn-keyring package to import the GPG key:
sudo pacman -S archlinuxcn-keyring
The author made an error when installing this package and could not add the key to the corresponding file. Finally, refer to the following article GnuPG-2.1 and pacman keyring : Due to the upgrade to gnupg-2.1, pacman upstream updated the format of the keyring, which made the local master key unable to sign other keys. This is not a problem unless you want to customize the pacman keyring. However, it is recommended that all users generate a new key ring to solve potential problems.
sudo pacman -Syu haveged
sudo systemctl start haveged
sudo systemctl enable haveged
sudo rm -fr /etc/pacman.d/gnupg
sudo pacman-key --init
sudo pacman-key --populate archlinux
sudo pacman-key --populate archlinuxcn
Then install it again.
6.2 Install yaourt package manager
It is also a package manager of the archlinux operating system, using aur
sudo pacman -S yaourt yay
6.3 Install google browser or firefox browser
firefox browser
sudo pacman -S firefox
sudo pacman -S flashplugin #注意浏览器中flash的支持
chromium browser
sudo pacman -S chromium
Google Chrome browser
sudo pacman -S google-chrome
6.4 Install WPS-Office software
You only need to perform the following operations under the terminal to install
sudo pacman -S wps-office-cn # 安装主体WPS办公软件
sudo pacman -S wps-office-mui-zh-cn # 安装中文软件包
sudo pacman -S ttf-wps-fonts # 安装字体文件
6.5 Install Chinese input method
Install fcitx input method framework
sudo pacman -S fcitx
sudo pacman -S fcitx-configtool
sudo pacman -S fcitx-gtk2 fcitx-gtk3 fcitx-qt4 fcitx-qt5
Install Sogou Pinyin input method
sudo pacman -S fcitx-sogoupinyin
Configuration file
nano ~/.xprofile
Add the following content
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS="@im=fcitx"
Take effect
source ~/.xprofile
Maybe pacman cannot find the Sogou input method, you can use the yaourt package manager to install it. Note that the yaourt package manager does not need to use sudo, it executes the root command directly
yaourt -S fcitx-sogoupinyin
In this way, the installation is successful, and the unresolved problem is the Chinese garbled problem of Sogou input method.
6.6 Install XRDP
Installation package management tool
sudo pacman -S yay
Install dependent libraries
sudo pacman -S binutils nasm patch
Install XRDP
yay -S xrdp
reference
[1] arclinuxcn
[2] archlinux
[3] Install Sogou Pinyin input method on Archlinux