Home > Article > Backend Development > linux production environment setup, linux environment setup_PHP tutorial
Today we set up a Linux production environment again. This is something that has many steps, is very tedious and has to be done. Although I have done it many times, I still don’t remember many steps and commands. It is troublesome to look for information everywhere every time, so I wrote down some steps for easy search.
1 |
mysql -h 192.168.1.100 -u root -p
|
Give the user with account user1 and password 123456 the select, insert, update, and delete permissions for all tables in the testDB database:
1 |
grant select ,insert,update,delete on testDB.* to user1@ '%' identified by '123456' ;
|
Refresh permissions:
1 |
flush privileges;
|
1 |
show variables like 'max_connections' ;
|
1 |
vi /etc/my .cnf
|
Find max_connections=100
(if not, add it), change it to:
1 |
max_connections=1500
|
Use your own computer to log in to the Linux server without a password (you are a Windows system)
on windows
Use cmd command to execute:
1 |
ssh -keygen -t rsa
|
Press Enter three times in a row, you can see it in the .ssh
folder in the user directory of C drive,
id_rsa is the private key and id_rsa.pub is the public key.
on linux
Execute,
1 |
ssh -keygen -t rsa
|
Press Enter 3 times, then cd .ssh/
you can see,
1 |
id_rsa id_rsa.pub
|
Create a public key to save the public key generated by the login-free host, authorized_keys
1 |
touch authorized_keys
|
Change his permissions to 600
1 |
chmod 600 ~/. ssh /authorized_keys
|
Finally, write the id_rsa.pub public key of the Windows computer into authorized_keys and save it.
The name of the downloaded JDK file will look like thisjdk-8u65-linux-x64.rpm?AuthParam=1445848743_f162eddc392f630f3b14bcded3bc3f19
Change it to jdk-8u65-linux-x64.rpm
. The command is as follows:
1 |
mv jdk-8u65-linux-x64.rpm?AuthParam=1445848743_f162eddc392f630f3b14bcded3bc3f19 jdk-8u65-linux-x64.rpm
|
Download JDK
1 |
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, give 777 permissions
1 |
` chmod 777 jdk-8u65-linux-x64.rpm`
|
Installation
1 |
rpm -ivh jdk-8u65-linux-x64.rpm
|
View
1 |
java -version
|
Modify the system environment variable file
1 |
vi /etc/profile
|
Append the following content to the file:
1 2 3 4 5 |
JAVA_HOME= /usr/java/jdk1 .8.0_65
JRE_HOME= /usr/java/jdk1 .8.0_65
PATH=$PATH:$JAVA_HOME /bin :$JRE_HOME /bin
CLASSPATH=.:$JAVA_HOME /lib/dt .jar:$JAVA_HOME /lib/tools .jar:$JRE_HOME /lib
export JAVA_HOME JRE_HOME PATH CLASSPATH
|
Make changes effective immediately:
1 |
source /etc/profile
|
Processing source:
1 |
rpm -ivh http: //nginx .org /packages/centos/6/noarch/RPMS/nginx-release-centos-6-0 .el6.ngx.noarch.rpm
|
View nginx information of yum:
1 |
yum info nginx
|
Installation:
1 |
yum install nginx
|
Start nignx:
1 |
service nginx start
|
Enter the host address to view:
http://192.168.1.100/
See,
1 2 3 4 5 6 7 8 |
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.
|
Indicates success.