Series Article Directory
【本地网络服务器】(一)Windows安装CentOS双系统
【本地网络服务器】(二)外网连接本地系统
Table of contents
[Local network server] (1) Windows installation CentOS dual system
[Local network server] (2) External network connection to the local system
(3) Configure the wireless network environment
(4) Activate the wireless network card
(6) Wireless network related configuration
(7) If the ping fails to www.baidu.com
(8) Chinese garbled characters are displayed on the terminal interface
(9) Repair win7 boot boot items
(10) Modify the notebook to close the cover and sleep problem
foreword
Last year, it happened that Alibaba Cloud was doing a promotional activity, and then I went to collect some cashmere. By receiving benefits for newcomers , it cost less than 200 yuan to buy a shared S6 for one year. It is very cost-effective for newcomers to receive benefits in the first year to buy servers. , It will be much cheaper than building a local server by yourself, and it will be calculated according to the electricity bill. The local server has 1 kilowatt-hour of electricity a day, 1 yuan for 1 kilowatt-hour of electricity, and 365 yuan for 365 days. This does not include broadband fees, etc., so newcomers Don't worry about the 200 or 300 yuan, go boldly to squeeze the wool, of course, you can also squeeze the wool from Tencent Cloud- New Year 618 special event . At the end of May this year, my Alibaba Cloud server has changed from a newcomer to an old one, and then due to the lack of money, I don’t even have a 3.6% discount on renewal fees, so I have to settle for the next best thing and use my 10-year-old laptop to build it. A local web server.
If you want to build a local network server, you first need to install a server system on your laptop, because the CentOS system is relatively complete as a server, so you can choose the CentOS 8-Stream system.
Do not choose CentOS 8, because 8 has ended its mission on December 31, 2021 last year, and Stream is a seamless switching system for CentOS 8. After 8 is installed, you cannot use yum to install software. Of course, there are solutions. But it needs to be connected to the Internet, that is, after the installation of your system is completed, you first need to configure the network, and then connect to the Internet to solve the problem of no AppStream update source.
1. CentOS system download
The system type needs to be selected according to the notebook processing architecture. Mine is the intel i5 series, so I chose the x86_64 installation package
CentOS-Stream-8-x86_64-latest-dvd1.iso
Download link of other Alibaba Cloud systems -- CentOS 8-Stream system
If you use the dual system installation method, you need to make a boot disk. First, format the U disk. The U disk cannot be formatted in NTFS format, otherwise it cannot be mounted to the Linux system disk. Ext4 and fast32 formats are acceptable.
The downloaded system is an ISO image. Run UltraISO as an administrator, open the downloaded image file, and then directly write to the image. Don’t choose the wrong disk.
After the U disk boot disk is created, it is necessary to modify the startup options of the computer. Most notebooks can be turned on and pressed ESC to enter the modification interface of the system, and then set the U disk as the first startup item. Then restart.
2. System installation
(1) Startup items
First of all, you need to know the drive letter of the USB flash drive. If you don’t know it, follow the steps below. If you already know it, you can skip it.
Press the Tab key (some are e keys), change the bottom to the following, and press Enter to confirm after the modification is completed.
vmlinuz initrd=initrd.img linux dd quiet
Determine the drive letter of the USB flash drive based on the format.
Sda1 nfs
Sda2 nfs
Sdb4 vfat
After confirming the drive letter, enter reboot on the installation failure interface to restart and enter the installation interface again, or restart directly with the power button. Also press the Tab key to change stage2 to hd: sda4 (corresponding to the drive letter of the U disk)
[ 0.006334] x86/cpu: VMX (outside TXT) disabled by BIOS
[ 23.527136] dracut-pre-udev [611]: anaconda-modprobe: Module floppy not found
[ 25.605231] dracut-pre-udev [611]: anaconda-modprobe: Module cbc not found
[ 25.665563] dracut-pre-udev [793]: modprobe: ERROR: could not insert 'sha256_mb': No such device
[OK] Started Show Plymouth Boot Screen.
[OK] Reached target Local Encrypted Volumes.
[OK] Reached target Paths.
[OK] Started Forward Password Requests to Plymouth Directory Watch.
[33.997586] [drm:uud_v1_0_start [radeon]] *ERROR* UVD not responding, trying to reset the VCPU !!!
[** ] A start job is running for udev Wai?ice Inittialization (16s / 3min 7s)
If the above error occurs, it means that the boot drive letter hd: sda4 has not been modified, and the installation path of the image file is used by default, so it needs to be modified to the U disk installation method
(2) Mounting options
Select the location of the hard disk where the system is installed (Note: If the hard disk has data, click the Finish button to pop up the option to recover the data disk).
Other settings such as language, root user password (weak password needs to be clicked twice to complete) are basically directly configured.
The most important thing is that you need to configure the CentOS 8-Stream installation source, just manually enter the following, pay attention to capitalization .
mirrors.aliyun.com/centos/8-stream/BaseOS/x86_64/os/
After the installation source configuration is complete, you can enter the software selection interface. If it is a wireless network installation, it is recommended not to choose the minimum system installation. The minimum system installation does not even have the ifconfig command.
Finally, this interface pops up. Congratulations, you have completed the installation of the CentOS system.
(3) Configure the wireless network environment
After the system is installed, the first thing that needs to be configured is the network.
At the beginning, the system did not have a wireless network card installed.
Error: No Wi-Fi device found.
After a wired network connection is required, download and install two network-related packages.
yum -y install network-scripts
yum -y install NetworkManager-wifi
Reboot required after installation
reboot
After restarting, type the following command and you can see that the unmanaged (unmanaged) status of the wireless network card disappears.
nmcli d
Among them, eno1 is a wired network card, and wlp4s0 is a wireless network card. Because the wifi has been connected successfully, the color shows normal green.
(4) Activate the wireless network card
Enable the wireless network card command, wireless network card (wlp4s0 needs to be replaced with the local network card name).
ip link set dev wlp4s0 up
(5) connect wifi
scan wifi
nmcli d wifi
connect wifi
nmcli d wifi connect "myWifi" password "123456"
(6) Wireless network related configuration
Configure the relevant information of the network, static IP
vi /etc/sysconfig/network-scripts/ifcfg- #(The # here needs to be replaced with the corresponding wireless network name)
There are only a few items that need to be modified, ONBOOT=yes, BOOTPROTO=static. (You need to press the i key to edit the vi command, press the esc key to save and exit, and then enter: wq)
IP address and gateway can be fixed
IPADDR=192.168.31.224
NETMASK=255.255.255.0
GATEWAY=192.168.31.1
There is another method for modifying the graphical interface below, the space bar is the selection/cancel key, press Enter for confirmation, and the arrow keys for selection.
nmtui
Whether to choose automatic connection depends on which network you prefer to use. I use wifi first, so cancel the automatic connection of wired eno1.
(7) If the ping fails to www.baidu.com
ping:www.baidu.com
Name or service not known
There may be several reasons.
a. Confirm whether it is connected to the network
ifconfig
The connected network has an IP address (fixed ip will also be displayed without a network), subnet mask, and generally the values of RX packets and TX packets are not 0. The easiest way is to ping the network ip, and you need to modify the corresponding local IP for ping
ping 192.168.31.1
b. Confirm the wireless network gateway
Add the gateway command, this can only take effect temporarily, and it will be invalid after restarting the network card
route add default gw 192.168.*.1 ( need to be changed to your own IP address )
Permanent modification method, # symbol, wired connection is similar to eno, wireless network is the corresponding wifi name, configure ipaddr and gateway as above
vi /etc/sysconfig/network-scripts/ifcfg- #(The # here needs to be replaced with the corresponding network name)
At the same time, the IP and gateway can also be fixed. When using intranet penetration and port forwarding later, a fixed IP is required
vi /etc/rc.local
Add the following paragraph, and change the following IP addresses to the corresponding local IPs.
ip route add 192.168.*.* 192.168.*.1
c. Has the DSN server been modified?
vi /etc/resolv.conf
There is at least one nameserver in the file. If NetworkManager is installed later, it will be automatically modified to the local 192.168.*.1.
nameserver 114.114.114.114
nameserver 8.8.8.8
If multiple connections are configured at startup, such as eno1 and ''myWifi" two connections.
It may also cause ping www.baidu.com to fail, but the error is Destination Host Unreachable.
Temporary modification
nmcli c down eno1
The permanent method, using the nmtui image interface method above.
Edit the eno1 connection, cancel the x of Automatically connect, select the x, and uncheck the blank.
(8) Chinese garbled characters are displayed on the terminal interface
All Chinese has been converted to unicode encoding format, which cannot be displayed normally
1. View the language environment variables of the system;
echo $LANG
You can see that the system is configured in Chinese format (zh_CN.UTF-8), if not, modify the file to the above format.
vi /etc/locale.conf
make changes effective
source /etc/locale.conf
2. View terminal xshell encoding;
3. Restart the server after the modification is complete.
(9) Repair win7 boot boot items
This is only for laptops with dual systems installed, please skip if it is installed on a virtual machine
vi /boot/grub2/grub.cfg
Add the following content
### BEGIN /etc/grub.d/30_os-prober###
menuentry “Windows 7” {
insmod ntfs
set root=(hd0,1)
chainloader +1
}
### END /etc/grub.d/30_os-prober###
View current startup items
grub2-editenv list
Of course, you can modify the default startup system to win7
grub2-set-default ‘Windows7’
(10) Modify the notebook to close the cover and sleep problem
This is also only for laptops with dual systems installed.
vim /etc/systemd/logind.conf
After the modification is completed, reboot and restart. After the restart is completed, close the lid of the laptop and the system will not stop again.
Summarize
Basically, there are so many steps to install the system. The problems that may be encountered during the installation process are also given solutions. This article is the first step in building a local network server. Install the system for the server. The next article introduces how to configure it. The local network allows the external network to access the local server.