- aliyun , remi, mysql
# Set up aliyun library
$ wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
# Set up the remi library,Set up the mysql library
$ yum install http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
# Due to mysql copyright restrictions,Centos 7 does not have a built-in mysql server,Must be installed from the mysql official
$ yum install http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
Source address: nginx: Linux packages Create vi /etc/yum.repos.d/nginx.repo
, and fill in the following content to install the yum repository
library
[ nginx]
name=nginx repo
baseurl=http://nginx.org/packages/OS/OSRELEASE/$basearch/
gpgcheck=0
enabled=1
Replace OS
with "rhel" or "centos" Replace OSRELEASE
with 5", "6", or "7"
# Update metadata
$ yum makecache
# Update system
$ yum update
# Install common software
$ yum install vim git supervisor redis
# Install php based on remi,So you need to install the remi source
# If you need to install another version,You need to repo=remi-php7x
$ yum install --enablerepo=remi-php70 php php-pdo php-fpm php-mbstring php-mcrypt php-gd php-mysqli php-zip
# Install nginx
$ yum install nginx --enablerepo=nginx
# Install mysql server
$ yum install mysql-server
# Start service
$ systemctl start php-fpm mysqld nginx supervisord
# boot
$ systemctl enable php-fpm mysqld nginx supervisord
$ systemctl start mysqld
# mysql 5.7 A temporary password will be generated when the installation is complete,We need to find the error log`/var/log/mysqld.log`To get this temporary password
# use below command to see the password:
$ grep 'temporary password'/var/log/mysqld.log
[ Note] A temporary password is generated for root@localhost: _ab3BAKulW?r
$ mysql_secure_installation
Securing the MySQL server deployment.
Enter password for user root:******
New password:******
Re-enter newpassword:******
The 'validate_password' plugin is installed on the server.
The subsequent steps will run with the existing configuration
of the plugin.
Using existing password for root.
Estimated strength of the password:100
Change the password for root ?((Press y|Y for Yes, any other key for No):*
Estimated strength of the password:100
Do you wish to continuewith the password provided?(Press y|Y for Yes, any other key for No): y
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.
Remove anonymous users?(Press y|Y for Yes, any other key for No): Y
Success.
Normally, root should only be allowed to connect from'localhost'. This ensures that someone cannot guess at
the root password from the network.
Disallow root login remotely?(Press y|Y for Yes, any other key for No): N
... skipping.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.
Remove test database and access to it?(Press y|Y for Yes, any other key for No): N
... skipping.
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now?(Press y|Y for Yes, any other key for No): Y
Success.
All done!
How to set a password
$ mysql -uroot -p******
mysql>set password for'root'@'localhost'=password('markzhao123456');
mysql> exit
# /etc/nginx/nginx.conf
user nginx nginx;
# /etc/nginx/conf.d/default.conf
server{
listen 80;
# If this is IP,Will allow access,otherwise,You can't visit even if you break the egg
server_name www.domain.com ;
index index.php index.html index.htm default.html default.htm default.php;
root /webdata/www/domain/public;
# Note here that the difference from the server itself is
# fastcgi_param SCRIPT_FILENAME /scripts/$fastcgi_script_name;
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# Will cause FastCGI sent in stderr:"Primary script unknown"while reading response header from upstream
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;}
location /{
try_files $uri $uri//index.php?$query_string;}
location ~.*\.(js|css)?$ {
expires 12h;}
access_log /webdata/logs/domain_access.log;
error_log /webdata/logs/domain_error.log;}
# /etc/php-fpm.d/www.conf
user = nginx
group = nginx
# Time zone
date.timezone = Asia/Shanghai
$ chown -R nginx:nginx /var/lib/php/session/
# Configure http
$ firewall-cmd --permanent --zone=public--add-service=http
# Configuration 3306
$ firewall-cmd --permanent --zone=public--add-port=3306/tcp
# Restart firewall
$ firewall-cmd --reload
CREATE USER 'remote'@'%' IDENTIFIED WITH mysql_native_password AS 'U*OSy)iKk$XO9dMB';
GRANT ALL PRIVILEGES ON *.* TO 'remote'@'%' REQUIRE NONE WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0;
GRANT ALL PRIVILEGES ON `1dailian\_v2`.* TO 'remote'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES
Get the latest download address: http://dev.mysql.com/downloads/mysql/
Download link: http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-community-client-5.7.13-1.el7.i686.rpmhttp://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-community-server-5.7.13-1.el7.i686.rpm
# download
$ wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-community-client-5.7.13-1.el7.i686.rpm
$ wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-community-server-5.7.13-1.el7.i686.rpm
# installation
yum localinstall mysql-community-client**.rpm
yum localinstall mysql-community-server**.rpm
Reprinted from https://juejin.im/post/5c876968e51d454170785745
Recommended Posts