The best way to learn technology is to do it, and Linux is no different. Most of the students learn Linux command line operations are completed in the virtual machine, this way is convenient and fast, but really have a server for you to practice, isn’t it more fragrant?
Coincidentally, I just had such an opportunity. There was a Windows Server in my lab that no one was using. I thought no one was using it anyway, so I might as well use it to make git Server first. Who would have thought it would have cost me three days…
More not to say, or hurriedly record the history of blood and tears first, save later to step on the pit again.
CentOS install
I use CentOS 7.8 instead of Ubuntu because I don’t need a graphical interface because I use it on a server. CentOS has a lot of image downloads in China, so you don’t have to put up with the appalling speed of the official website.
CentOS has six versions of image files. You can download the image files based on your requirements.
CentOS-7-x86_64-DVD-1708.iso
Standard installation version (usually this is ok)CentOS-7-x86_64-Everything-1708.iso
Full version, integrated with all software (can be downloaded if you are not sure or need special packages)CentOS-7-x86_64-LiveGNOME-1708.iso
The GNOME desktopCentOS-7-x86_64-LiveKDE-1708.iso
The KDE desktopCentOS-7-x86_64-Minimal-1708.iso
The lite version comes with the least amount of softwareCentOS-7-x86_64-NetInstall-1708.iso
Network Install (Install or rescue system from the network)
Making boot disk
After downloading the image, use UltralISO software to make the boot disk. It should be noted that the full version must be used here, because the trial version may have problems, resulting in the subsequent installation process cannot proceed normally.
Select “Open” in the toolbar “File”, and then select “Write hard disk image” in the “Boot” to write the content to the USB disk. After the writing is finished, the boot disk will be finished.
Modifying the SERVER BIOS
One of the necessary steps to install the system, modify the computer boot order. A server can also be considered a computer, and this step is also necessary.
Each manufacturer’s machine has a different way of accessing the BIOS. The server I configured this time is Huawei, and I entered by pressing DEL when I started up. After entering BIOS, the U disk can be mentioned as the first boot sequence.
System installation
In the process of installing the system, I stepped on many pits and reinstalled them for three times, which wasted a long time. The following is mainly about the pits and the normal ones.
The first is when you first enter the boot disk
Install CentOS Linux 7
e
Labal=
Pay attention to
CENTOS
F:
After entering the installation interface, first of all, you need to choose a language. It is best to choose English here, otherwise, it is very troublesome for the command line operation when Chinese appears in the later system.
Then set the time zone to Shanghai
After setting the time zone, select the software package. Do not forget this step. Otherwise, the installation program uses minimum installation by default and many tools will be unavailable after the installation.
Select the installation location.
After selecting the installation location, remember to configure the network. If you install the version without GUI, the command line network configuration is still more troublesome.
dbcp
Complete these steps and click to start installation. You also need to set the root password on the installation screen. After setting the password, wait until the installation is complete.
All kinds of configuration
After the installation is complete, some configuration needs to be done to optimize the experience.
The network configuration
The first problem I encountered after the installation was that the network port connecting to the LAN switch and the network port connecting to the Internet could not be used at the same time. Later, it is found that the Network and NetworkManager management tools in the system conflict. In this section, disable NetworkManager and add it to the IFCFG file
NM_CONTROLLED=no
Copy the code
There actually seems to be a better way to handle both and run them at the same time, and NetworkManager seems to be the better choice, but FOR ease of use, I won’t dig into that.
SSH configuration
As a server most of the time must be remote login control, it is impossible to go to the machine room every time. So SSH configuration is very important.
First, generate the public and private keys on your Windows host and enter them on the command line
ssh-keygen
Copy the code
This will generate two files, one public key and one private key, in the C:\Users\ username \. SSH directory.
In this case, you need to enable SSH (by default) on the server, and then copy the contents of the id_rsa.pub file generated on the client to the ~/. SSH /authorized_keys file on the server. Open the /etc/ssh/sshd_config file and modify the two variables
GSSAPIAuthentication no
UseDNS no
Copy the code
In this way, the client can quickly connect to the server without encryption.
PuTTY
The next recommended remote connection artifact PuTTY, after entering the interface is like this
Open PuTTYgen installed with PuTTY
Load
id_rsa
.ppk
PuTTY
.ppk
Open
Oh-my-zsh and plug-in installation
Oh-my-zsh is a terminal optimization software based on ZSH, installed in Linux system can make the interface better, plus the plug-in can automatically complete, highlighting spelling errors, very useful. WSL+ OH-my-ZSH + CMDER configuration record for details.
At this point, the server configuration is complete, the large memory can be enough for me to save a lot of things, git repository can also be moved here, the most important is to save money to buy cloud server, comfortable. If there is a need behind you can also make a public IP or Intranet penetration to achieve external remote operation, very convenient.