Set root password for the first time
sudo passwd root
1, Installing nginx
1. Apt get installation command
sudo apt-get install nginx
Error: "Unable to locate package nginx"
Solution: execute the command before installation to update the software source
sudo apt-get update
Location of nginx files after installation:
- /usr/sbin/nginx: main program
- /etc/nginx: store configuration files
- /usr/share/nginx: store static files
- /var/log/nginx: store logs
2. Download nginx package installation
Uninstall nginx installed by apt get
# Uninstall nginx completely apt-get --purge autoremove nginx #View the version number of nginx nginx -v
1) Install dependent packages
sudo apt-get install gcc sudo apt-get install libpcre3 libpcre3-dev sudo apt-get install zlib1g zlib1g-dev # Ubuntu14. No openssl dev is found in the warehouse of 04, which is replaced by the following openssl and libssl dev #apt-get install openssl openssl-dev sudo apt-get install openssl sudo apt-get install libssl-dev
2) Install pcre to enable nginx to support rewrite
cd /usr/local/src wget http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz tar zxvf pcre-8.35.tar.gz cd pcre-8.35 ./configure make && make install # View pcre version pcre-config --version
3) Installing nginx
cd /usr/local mkdir nginx cd nginx # Other versions of nginx compile with errors, so choose nginx-1.18 0 wget http://nginx.org/download/nginx-1.18.0.tar.gz tar -xvf nginx-1.18.0.tar.gz cd nginx-1.18.0 # normal setup ./configure --prefix=/usr/local/webserver/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/usr/local/src/pcre-8.35 # Attach gzip_static ./configure --prefix=/usr/local/webserver/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/usr/local/src/pcre-8.35 --with-http_gzip_static_module make && make install # View nginx version /usr/local/webserver/nginx/sbin/nginx -v
2, Install mysql
1. Installation configuration
1) Installation
sudo apt-get install mysql-server
Version 8.0 is installed here by default
2) Initialize configuration
sudo mysql_secure_installation
There are many configuration items, as shown below:
#1VALIDATE PASSWORD PLUGIN can be used to test passwords...Press y|Y for Yes, any other key for No: N (My options)#2Please set the password for root here...New password: (Input password)Re-enter new password: (Repeat input)#3By default, a MySQL installation has an anonymous user,allowing anyone to log into MySQL without having to havea user account created for them...Remove anonymous users? (Press y|Y for Yes, any other key for No) : N (My options)#4Normally, root should only be allowed to connect from'localhost'. This ensures that someone cannot guess atthe root password from the network...Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y (My options)#5By default, MySQL comes with a database named 'test' thatanyone can access...Remove test database and access to it? (Press y|Y for Yes, any other key for No) : N (My options)#6Reloading the privilege tables will ensure that all changesmade so far will take effect immediately. Reload privilege tables now? (press y|y for yes, any other key for no): Y (my option)
3) Check mysql service status
systemctl status mysql.service
2. Configure remote connections
mysql > grant all privileges on root.* to root@'%'The error message prompted is as follows: You are not allowed to create a user with GRANT;
1) The reason why the user cannot be authorized is that the host attribute value of the specific user (root) in the user table in the mysql database is localhost
The solution is as follows:
# use mysql database mysql > use mysql;# User specific host modify# Note that in the real production environment, this modification is not recommended because the security risk is too great. I suggest that it should be changed according to the actual situation root User's host Item is modified to a specified ip Address, or remain localhostmysql > update user set host='%' where user='root';# Specifies the authorization of the user,to grant authorization root Users have all permissions on all tables of the specified library and set remote access mysql > grant all privileges on Specify Library.* to root@'%';# Refresh quanxianmysql > flush privileges;
Steps for configuring 3306 ports for remote connection
Check whether the port is open
netstat -an|grep 3306
2) Comment out the configuration file / etc / MySQL / MySQL conf.d/mysqld. cnf
# bind-address = 127.0.0.1
Restart mysql
/etc/init.d/mysql restart
3) Another reason is that MySQL version 8.0 has modified the default encryption rules, and errors will be reported when connecting with Navicat. The solution is to execute the following statements
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root123';
In 'root' @ '%', root is the user name and '%' is the value of the host field in the user table. ' root123 'is the user password
4) Alibaba cloud servers need to configure security group rules and open ports
3. Problem solving
reference resources: Solve mysql configuration only_ FULL_ GROUP_ Error caused by by
1) Modify the configuration file / etc / MySQL / MySQL conf.d/mysqld. CNF, add code under [mysqld]:
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
2) Restart mysql
/etc/init.d/mysql restart
3, Install jdk
1. Installation
Because Oracle's OpenJDK 11 has the same functions as its Oracle JDK 11, if you do not need Oracle's business service support, you are strongly recommended to use OpenJDK because its package management, integration and update are convenient.
Use the following command to install OpenJDK on Ubuntu 18.04, 19.04 and 20.04.
sudo apt install openjdk-11-jdk
2. Check
At the same time, the openjdk-11-jre package will be installed, which contains the runtime package of java. After that, you can check the version with the following command:
java -version
The output is as follows:
openjdk 11.0.11 2021-04-20OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.20.04)OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.20.04, mixed mode, sharing)
###3. If two versions are installed, you can set them as follows
Step 1: place JDK 8 under the selected system:
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.8.0_221/bin/java 1sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.8.0_221/bin/javac 1
Use the following command to select the default JDK version
sudo update-alternatives --config javasudo update-alternatives --config javac
4, Install redis
1. Installation
sudo apt-get install redis-server
2. Check
Use the ps -aux|grep redis command to see the default port 6379 of the server system process
ps -aux|grep redis
View redis server status
# View port listening netstat -nlt|grep 6379# View the redis server status sudo / etc / init d/redis-server status