Last time I went with the operation and maintenance side to install the internal environment, and found that the linux command is still not very skilled. Especially the user authority assignment and shortcut operations under vi. So I decided to install a CentOS virtual machine locally, and I would learn some common Linux commands every day when I had time.
As a little white officially entered the pit of CentOS, so there was a CentOS exploration series. I will continue to update according to my own exploration.
CG54H-D8D0H-H8DHY-C6X7X-N2KG6 ZC3WK-AFXEK-488JP-A7MQX-XL8YF AC5XK-0ZD4H-088HP-9NQZV-ZG2R4 ZC5XK-A6E0M-080XQ-04ZZG-YF08D ZY5H0-D3Y8K-M89EZ-AYPEG-MYUA8
CentOS-7-x86_64-DVD-1708.iso After the previous installation is complete, I need to download something, so I use the yum install command, and found that I need root privileges, so I use the su root command to switch users, I need to enter the root password, I enter the one I created The user password consistently shows that the authentication failed, and it's over. It seems that the password must be changed once...
Fortunately, changing the password is not complicated. Here is a correct and feasible link: https://linux.cn/article-3962-1.html. In summary, the basic steps include the following:
ro with rw init=/sysroot/bin/shchroot command, and then execute passwd to start password modificationtouch /.autorelabel to update system information, and execute exit to exit chroot modereboot to restart After changing the root password, I switched to root mode. I wanted to use the yum install command to download and found that an error was reported that the network was not connected. So I tried: ping www.baidu.com, and reported a name or service not know. The rogue continued to search for solutions and finally found that the solution mentioned by https://www.cnblogs.com/Lin-Yi/p/7787392.html can solve my problem normally. Here are the key points:
vi /ect/resolv.conf, add the following two lines in the file: nameserver 8.8.8.8 nameserver 8.8.4.4
Restart the virtual machine after saving and exiting
vi /etc/sysconfig/network-scprits/ifcfg-ens33 (the number after the file name ifcfg-ens33 may be different, it is best to go to the corresponding directory ls to see), and change the onboot=no replaced with onboot=yes. Save and exitservice network restart under root to restart the network After solving these basic problems, I found that the mouse could not select and copy text in centOS, so I continued to search and solve it. The final solution is as follows:
yum install gpm*service gpm startsystemctl enable gpm.serviceHere are the relevant methods for enabling and disabling CentOS services:
systemctl start [Service file name]
systemctl restart [Service file name]
systemctl stop [Service file name]
systemctl status [Service file name]
Set boot up
systemctl enable [Service file name]
systemctl disable [Service file name]
After installing gpm, the text can be copied and pasted inside CentOS, but it cannot be copied between the virtual machine and the host. Internet search said to install VMTools, OK to start the installation.
Mainly refer to the following two links: https://blog.csdn.net/warnerwu/article/details/73718901https://www.cnblogs.com/mylinux/p/5612168.html
Begin to prepare to install various software in CentOS to facilitate the operation of the virtual machine. After a subsequent search, I found that you can directly connect to CentOS through XShell. It is not much cooler to connect to CentOS directly through XShell than to open the ugly CentOS operation. So I began to explore XShell to connect to CentOS.
I wanted to fix the IP of the virtual machine so that I don't need to modify the IP every time I connect to CentOS. But after referring to the fixed IP tutorial on the Internet, something painful happened: The virtual machine can't connect to the network... and the port 22 of the local telnet virtual machine has been blocked! !
Only finally restored the network settings. After a few hours of tossing, I was able to ping Baidu again. .
Here is a summary of the relevant settings for XShell to connect to CentOS:
rpm -qa|grep ssh to check whether SSH is installed. If it is installed, the output will be roughly as follows: openssh-7.4p1-11.el7.x86_64 openssh-server-7.4p1-11.el7.x86_64 openssh-clients-7.4p1-11.el7.x86_64 libssh2-1.4.3-10.el7_2.1.x86_64
If it is not installed, execute yum install openssh* to install the corresponding ssh service. After the installation is complete, use the command systemctl status sshd to check whether the service is enabled. If it is not enabled, execute the command service sshd restart. After startup, use the command netstat -ant | grep 22 to further confirm whether the ssh port 22 is open
systemctl stop firewalld.service #Stop firewall systemctl disable firewalld.service #Prohibit firewall from booting up firewall-cmd --state #View the default firewall state (display notrunning after closing, display running after opening)
systemctl stop iptables.service #Restart the firewall to make the configuration effective systemctl disable iptables.service #Set the firewall to start on boot
Then you can happily use XShell to connect to CentOS
The newly installed CentOS does not support the rz/sz command. Here, use yum install lrzsz to install directly
The installation steps generally given on the Internet are as follows:
yum search jdk|grep javayum install java-1.8.0-openjdk.x86_64 It should be noted that in this case, only JRE is installed. At this time, the javac command cannot be enabled anyway. Here also need to install jdk correctly:
rpm -qa | grep jdk to find the jdk just installed. The results of my query are as follows java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64 java-1.8.0-openjdk-headless-1.8.0.161-0.b14.el7_4.x86_64
yum -y remove java java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64 yum -y remove java java-1.8.0-openjdk-headless-1.8.0.161-0.b14.el7_4.x86_64
yum install java-devel to directly install the native jdksudo vi /ect/profile, add the following configuration before the last two lines of the file: export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64 export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export PATH=$JAVA_HOME/bin:$PATH
source /etc/profileyum install wgetwget http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat /tomcat-9/v9.0.7/bin/apache-tomcat-9.0.7.tar.gztar -zxvf apache-tomcat-9.0.7.tar.gzsh startup.sh, the machine is accessed through the virtual machine IP: port to see if it is successful During the process of installing tomcat, I started to create the tomcat directory under the root user. Later I switched to the tomcat user and found that wget did not have permission to write this tomcat directory. So through the following command the permissions of the directory and its subdirectories are changed to tomcat users:
chown -R tomcat:tomcat tomcat where -R means all subdirectories under recursion
Execute cd - directly to return to the last operation directory. Enter cd or cd ~ to enter the root directory of the current user
Recommended Posts