Why Install Linux?
Download Linux and Create a Bootable Drive
Download any Linux distribution for free on their websites. For first time users, I recommend trying Ubuntu where although there are many user friendly Linux distributions suited for beginners Ubuntu is the most popular general users Linux distribution today. If the information regarding to the problems you are facing are not already available online, then you can just ask the community and they usually respond quickly.
After downloading the Linux disk image is to create a bootable drive. The popular bootable drive today is a bootable USB where we the Linux into a USB and boot it in startup. I am guessing that most of you are Windows user and my favourite software to create a bootable drive is Rufus. If you are on MacOS or rarely you bought a laptop with Linux installed and want to install another Linux, my favourite is Balena Etcher. Ofcourse there are other utilities such as Win32 Disk Imager and Unetbootin, my favourites for now are Rufus and Etcher but feel free to try other utilities but becareful of malware.
Today's utility provides protection as it does not read internal and large external hard disks preventing us from messing our existing system. We can show them by clicking a checkbox and will notify us to proceed with caution. Well the only risk is that we may forget to backup the contents of our flash drive and procceed with the flash erasing the contents in the process. The main process from the video are:
Installing Linux Ubuntu
On Virtual Machine
If you want to try Ubuntu or any other operating systems (OS) but not yet confident in installing directly to the computer with reasons such as afraid of messing up the current system, then you can try virtual machines. Virtual machines runs your OS on top of existing one just like other software and applications so you do not need to worry about messing your current system. Another reason is if you have a high spec computer that is powerful enough to run 2 OS at the same time which may make you feel lazy to install two seperate OS in one PC (dualboot) and just install the OS on top of existing one. If you are confident enough or do need this step, just skip it. If you can afford, you can try VMware. If not, you can try VirtualBox. Detail discussion is not necessary here as you can just install and explore and delete and try again if you fail as there are no risk. However, from the video, here are some highlighted steps:
On Internal Hard Drive (Default Way)
Unfortunately, I do not have a video of installing alongside them but the recording should not be much different from install fresh. I do have a video of the "something else" option on the next subsection. Ofcourse, if you are an expert, you would probably prefer "something else" and make your own customization. The "install alongside ..." is just a user friendly option for general users.
On External Hard Drive
Installing on external hard drive is what something people rarely do but people do it because:
The installation method is similar but with few difference as follow after choosing the "Choose something else":
Today, Internet Protocol (IP) address version 4 is majorly used between computer communication over the network. However, most common people does not know that IP address is set on the network interface and not in the core system of the computer. For example, a laptop can have two IP address, one is on the cable and one is on the WiFi. This article guides users in setting IP address manually which can be for:
Set Up IP Address Manually
Windows Command Line
Using command prompt (CMD):
netsh interface show interface netsh interface ip set address "[chosen interface]" static [ip address] [subnet mask] [gateway] [metric] netsh interface ipv4 set dns name=”[YOUR INTERFACE NAM]” static [DNS SERVER], for example: netsh interface ip set address "Ethernet" static 192.168.100.25 255.255.255.0 192.168.100.1 1 netsh interface ipv4 set dns name=”126.96.36.199” static Ethernet
Linux GUI (Debian)
Linux Command Line (Debian)
sudo ifconfig [interface] [ip address] netmask [subnet mask] up route add default gw [IP-ADDRESS] [INTERFACE-NAME], for example sudo ifconfig eth0 192.168.100.22 netmask 255.255.255.0 up route add default gw 192.168.100.1 eth0
sudo ip addr add [ip address]/[netmask id] dev [interface] sudo ip route add default via [gateway], for example sudo ip addr add 192.168.100.22/24 dev eth0 sudo ip route add default via 192.168.100.1
For DNS, edit /etc/resolve.conf:
I assumed that you got your laptop running and the only thing left is installing Nvidia video driver to perform more advance tasks such as playing video games and parallel processing. Simply, the checklist is knowing your video graphic card and which driver version suits it. For example, my laptop graphic card is Nvidia 720M which has a compute capability of 2.x Fermi. Therefore, the highest Nvidia driver version that supports is 390s and finally the highest cuda version is 8.0 where higher versions are not supported.
This section is for those who have tried and failed and neeeded to restore the default installation. If you think you do not need this section, go ahead and do so. Still, starting here will be using full terminal in administrator mode and not GUI. If you messed up bad, try pressing ctrl+alt+f2 (try all f1-f12 until you are presented with a terminal). The concept is find all the Nvidia, Cuda, Primus, Bumblebee, and any packages that you just installed and uninstall them and finally reinstall Nouveau. Here I use aptitude to see the packages.
sudo su apt install aptitude aptitude search nvidia aptitude search cuda aptitude search bumblebee aptitude search primus
Uninstall all of them one by one or try the following command line and if the following command does not work then uninstall them one by one.
apt-get purge 'nvidia.*' apt-get purge 'cuda.*' apt-get purge 'bumblebee.*' apt-get purge 'primus.*'
Check again using aptitude and after everything is uninstalled, install Nouveau.
apt-get install 'nouveau.*'
Check modprobe configuration directory (/etc/modprobe.d etc), move all files associated with Nvidia to another directory, and check all remaining files whether Nouveau is blacklisted and if so remove the blacklist. Finally, restart your laptop.
Install Nvidia Video Driver
Most of the time is best practice to update and upgrade your system:
apt update apt full-upgrade
Before continuing, you can checked your video cards information and driver installed using the following commands:
The general way to install nvidia driver in Linux is to install nvidia-kernel-dkms. I recommend to install nvidia-smi as well if it is not included in the installation as it is on of the best way to see whether the driver is working or not.
apt install nvidia-kernel-dkms apt install nvidia-smi
I recommend to reboot to see whether this step is problematic or not. If you are using an older Optimus Laptop like me with Intel HD Graphic and Nvidia, the probability is high that Nvidia driver will not work and will leave you with blank screen. If you have internet connection through LAN cable or USB tethering than there is no fear of rebooting as you can easily connect to the Internet. If you use WiFi than it can be challenging setting up Internet using the command line so I recommend to learn how to do it first. If you are already sure that it will be a blank screen, then do not reboot and proceed to the next step.
Fixing Blank Screen After Nvidia Driver Installation
If in the end you are left with a blank screen then press ctrl+alt+f2 (try from f1-f12) to start the console. Once you are successful, connect to the Internet and check the version of the installed nvidia package.
apt show nvidia-kernel-dkms
Go back to the check list section and see whether the driver version supports your card or not. In my case, the driver installed is the latest version that does not support my old GT720M. The highest that supports is 390. Therefore search for suitable nvidia driver version in your package manager. If you cannot find a suitable version in you package manager then you have to download manually from Nvidia website. Usually, when trying to install, the previous version that you installed will be replace but if it does not then purge it manually.
aptitude search nvidia apt install nvidia-legacy-390xx-kernel-dkms reboot
If the last step still does not work then try either or both of the following steps. The first step is to install opencl where I found this step on Kali Linux Website.
apt install mesa-opencl-icd reboot
apt install nvidia-opencl-icd reboot
If everything works for you, then congratulations. As for my laptop, it only fixes the blank screen but Nvidia driver does not work when playing video games and performing parallel processing. The following solution fixes my problem and if it does not work, try to purge the opencls if you have installed. Bumblebee and bbswitch are packages for laptops that have multiple graphic cards.
apt install bbswitch-dkms bumblebee-nvidia nano /etc/bumblebee/bumblebee.conf nano /etc/bumblebee/xorg.conf.nvidia reboot
If everything succeeded, well done, if not then I do not know anymore ways for now so do comment if you found another way. Check everything:
lspci -v nvidia-smi lsmod glxgears glxdemo glxinfo
Install Cuda Toolkit
If you want it quick, you can try installing from package manager but do check whether the versions suits your Nvidia card or not:
apt show nvidia-cuda-toolkit apt install nvidia-cuda-toolkit nvcc -V type nvcc ls /usr/lib/nvidia-cuda-toolkit
For my case, the nvidia-cuda-toolkit version is to high. My Geforce 720M can only handle up to CUDA 8, so I have to go to https://developer.nvidia.com/cuda-toolkit-archive and get the suitable version.
dpkg -i [your deb package].deb apt-key add /var/cuda...../[...].pub (which will be shown on your terminal) apt update && apt install cuda-toolkit-8-0
Edit /etc/environment, edit and add the following lines:
reboot nvcc -V
CUDA 8 support GCC and G++ up to version 5 and not higher. So follow the instruction from https://unix.stackexchange.com/questions/384780/how-to-temporarily-change-default-version-of-gcc-in-archlinux
apt install gcc-5 g++-5 sudo ln -s $(which gcc-5) /usr/local/bin/gcc sudo ln -s $(which g++-5) /usr/local/bin/g++ hash -r
To restore default GCC:
sudo rm /usr/local/bin/gcc /usr/local/bin/g++ hash -r
If you are using Ubuntu or any distros mentioned on their website, it will be smoother to download install the deb package instead. If you have to use the run file, then do the following and finally check the logs if any errors persists.
sudo chmod +x cuda_8.0.61_375.26_linux.run sudo sh cuda_8.0.61_375.26_linux.run --override Follow the command-line prompts Do you accept the previously read EULA? accept/decline/quit: accept You are attempting to install on an unsupported configuration. Do you wish to continue? (y)es/(n)o [ default is no ]: yes Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 375.26? (y)es/(n)o/(q)uit: no Install the CUDA 8.0 Toolkit? (y)es/(n)o/(q)uit: yes Enter Toolkit Location [ default is /usr/local/cuda-8.0 ]: Do you want to install a symbolic link at /usr/local/cuda? (y)es/(n)o/(q)uit: yes Install the CUDA 8.0 Samples? (y)es/(n)o/(q)uit: yes Enter CUDA Samples Location [ default is /home/fajarpurnama ]: /usr/local/cuda-8.0/samples
Edit /etc/environment, edit and add the following lines: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/cuda/bin" LD_LIBRARY_PATH="/usr/local/cuda/lib64:/usr/local/cuda/targets/x86_64-linux/lib"
If you are on older cards, you need to search the suitable cuda version or maybe your card are not supported at all. For example, I once come across ancient cards of GTS250 and GT8800 with compute capability of 1.1 Tesla and the cudatoolkit that supports is 6.5.