Linux basic commands and linux basic notes
Today, we are building a Linux production environment. This is a complex task that has to be done. Although I have done it many times, there are still many steps and commands that I don't remember. Every time I find information everywhere, it is very troublesome. So I wrote down some steps for searching.
Log on to the remote MySQL database
mysql -h 192.168.1.100 -u root -p
Assign permissions to non-root accounts of MySQl
Grant select, insert, update, and delete permissions to all tables in the testDB database of the user whose user1 password is 123456:
grant select,insert,update,delete on testDB.* to user1@'%' identified by '123456';
Refresh permission:
flush privileges;
View the maximum number of connections in MySQL
show variables like 'max_connections';
Modify the maximum number of connections
vi /etc/my.cnf
Findmax_connections=100
(If not, add it), and change:
max_connections=1500
Password-free logon to Linux servers
Use your computer to log on to the Linux server without a password (You are a Windows system)
On windows
Run the following command in cmd:
ssh-keygen -t rsa
Press enter under 3, which can be in the user directory of drive C..ssh
Folder,
Id_rsa is the private key and id_rsa.pub is the public key.
On linux
Run,
ssh-keygen -t rsa
Press enter three times, and thencd .ssh/
As you can see,
id_rsa id_rsa.pub
Create a public key used to save the login-free host,authorized_keys
touch authorized_keys
Change his permissions to 600
chmod 600 ~/.ssh/authorized_keys
Finally, write the id_rsa.pub public key of the windows computer to authorized_keys and save it.
File rename
The downloaded JDK file name looks like thisjdk-8u65-linux-x64.rpm\?AuthParam\=1445848743_f162eddc392f630f3b14bcded3bc3f19
Change itjdk-8u65-linux-x64.rpm
. The command is as follows:
mv jdk-8u65-linux-x64.rpm\?AuthParam\=1445848743_f162eddc392f630f3b14bcded3bc3f19 jdk-8u65-linux-x64.rpm
Install JDK
Download JDK
wget http://download.oracle.com/otn-pub/java/jdk/8u65-b17/jdk-8u65-linux-x64.rpm?Auth Param=1445848743_f162eddc392f630f3b14bcded3bc3f19
Download and rename it to jdk-8u65-linux-x64.rpm, and grant 777 permissions.
`chmod 777 jdk-8u65-linux-x64.rpm`
Install
rpm -ivh jdk-8u65-linux-x64.rpm
View
java -version
Configure Environment Variables
Modify the system environment variable File
vi + /etc/profile
Append the following content to the file:
JAVA_HOME=/usr/java/jdk1.8.0_65JRE_HOME=/usr/java/jdk1.8.0_65PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/binCLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/libexport JAVA_HOME JRE_HOME PATH CLASSPATH
Make the modification take effect immediately:
source /etc/profile
Install nginx directly using centos yum
Processing Source:
rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
View the nginx information of yum:
yum info nginx
Installation:
yum install nginx
Start nginx:
service nginx start
Enter the host address to view the information:
Http: // 192.168.1.100/
See,
Welcome to nginx!If you see this page, the nginx web server is successfully installed and working. Further configuration is required.For online documentation and support please refer to nginx.org.Commercial support is available at nginx.com.Thank you for using nginx.
It indicates the operation is successful.
*Write down these records for now, and sort out the updates later. (Some Linux versions may not be fully applicable)