Linux Exploration Road 1---CentOS entry notes finishing

Preface#

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.


installation##

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


Modify root password##

​ 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:


Network connection is not on##

​ 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:

nameserver 8.8.8.8 nameserver 8.8.4.4
Restart the virtual machine after saving and exiting


Cannot select and copy with the mouse##

​ 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:

Here 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]

Install VMTools

​ 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

Local XShell connection to the virtual machine##

​ 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:

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


Install rzsz software##

​ The newly installed CentOS does not support the rz/sz command. Here, use yum install lrzsz to install directly


Install JDK

​ The installation steps generally given on the Internet are as follows:

​ 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:

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

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


Install tomcat


Modify the owner of the directory##

​ 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


How to return to the last entered directory##

​ 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

Linux Exploration Road 1---CentOS entry notes finishing
Linux notes (1): CentOS-7 installation
Linux Network Foundation (CentOS7)
Linux (centos7) build gitlab
Linux Centos7 install jdk1.8
CentOS (linux) install PostgreSQL
Ubuntu Linux study notes
Linux CentOS 7 installation tutorial
Centos 7 install JDK (Linux install jdk)
Centos7 notes | operating system startup process, Linux users and permissions