当前位置:网站首页>LNMP compilation and installation
LNMP compilation and installation
2022-06-25 19:13:00 【Getting drunk and getting better】
Create package storage address
sudo mkdir /usr/local/software
1、Nginx install
Installation dependency
apt-get install gcc automake autoconf make
install gcc g++ The dependent libraries
sudo apt-get install build-essential
sudo apt-get install libtool
install pcre Dependency Library
sudo apt-get update
sudo apt-get install libpcre3 libpcre3-dev
install zlib Dependency Library
sudo apt-get install zlib1g-dev
install SSL Dependency Library
sudo apt-get install openssl
The formal installation nginx
cd /usr/local/software
# Download stable version
sudo wget http://nginx.org/download/nginx-1.14.2.tar.gz
# decompression
sudo tar -zxvf nginx-1.14.2.tar.gz
# cut-in Unpack the directory
cd /usr/local/software/nginx-1.14.2
# Be careful : To switch to root The user executes the configuration command
# To configure , This last nginx All installation files for , Including configuration files , Will be installed to /usr/local/nginx Directory
./configure --prefix=/usr/local/nginx
make && make install
start-up nginx And look at the process
sudo /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
# Be careful :-c Specify the path of the configuration file , If not ,nginx The configuration file for the default path will be loaded automatically , Can pass -h View help command .
# Check the process :
ps -ef | grep nginx
Check the port
netstat -lntp
Configure boot up
sudo vim /etc/rc.local
# Add the following code
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf &
Add environment variables ( Others are separated by colons )
sudo vim /etc/profile
# Join in nginx route
export PATH=$PATH:/usr/local/nginx/sbin
install php (php 7.2)
Installation dependency
apt-get install libxml2-dev gcc autoconf
Get the source code and compile and install
Upload directly from local php Source code , perhaps wget Get online resources
sudo mkdir /usr/local/php
cd /usr/local/software
# Switch to root user Perform the following actions
wget https://www.php.net/distributions/php-7.2.16.tar.gz
tar -zxvf php-7.2.16.tar.gz
cd php-7.2.16
# Installation dependency
sudo apt update
sudo apt install gcc
sudo apt install make
sudo apt install openssl
sudo apt install curl
sudo apt install libbz2-dev
sudo apt install libxml2-dev
sudo apt install libjpeg-dev
sudo apt install libpng-dev
sudo apt install libfreetype6-dev
sudo apt install libzip-dev
sudo apt install libssl-dev
precompile
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysqli --with-pdo-mysql --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl-dir=/usr/bin/curl --enable-mbregex --enable-mbstring --enable-ftp --with-gd --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --disable-fileinfo --enable-maintainer-zts
Until you see this interface , Precompile successful
Compile and install , Parameters -j Specify the number of compilation threads for multi-threaded compilation
sudo make -j4
See this to complete the compilation
Execute the following command to install
sudo make install
After the installation is completed, enter the command to view the version
/usr/local/php/bin/php -v
Successfully compiled and installed from source code .
Finally, copy a configuration file compiled from the source code
sudo cp php.ini-development /usr/local/php/etc/php.ini
To configure php-fpm command :
cd /usr/local/php/etc cp php-fpm.conf.default php-fpm.conf
cd php-fpm.d cp www.conf.default www.conf
groupadd www
useradd -g www www
start-up
/usr/local/php/sbin/php-fpm
verification
ps -ef |grep php-fpm
Nginx analysis PHP Multisite configuration
cd /usr/local/nginx/conf
Edit the configuration file to multiple files
vim nginx.conf
hold nginx.conf Inside server{} Comment out in , Then import the following files
New folder
mkdir vhosts
cd vhosts/
New configuration file , It is recommended that the file name be recognized , One file, one site
vim 1.com.conf
Profile contents
server {
listen 8080; # Listening port
server_name 127.0.0.1; # Site domain name
root /home/wwwroot/test/public; # Site root
index index.html index.htm index.php default.html default.htm default.php; # The default navigation page
location / {
if (!-e $request_filename) {
rewrite ^(.+?\.php)(/.+)$ /$1?s=$2 last;
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}
# PHP To configure
location ~ ^(.+.php)(.*)$ {
fastcgi_split_path_info ^(.+.php)(.*)$;
include fastcgi.conf;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
location ~* ^.+\.(ico|gif|jpg|jpeg|png)$ {
access_log off;
root /home/wwwroot/test/public;
expires 7d;
}
}
restart
cd /usr/local/nginx
./sbin/nginx -s reload
Successful visit
Configure boot up
sudo vim /etc/rc.local
# Add code
/usr/local/php/sbin/php-fpm &
Add environment variables
sudo vim /etc/profile
# Join in nginx route
export PATH=$PATH:/usr/local/nginx/sbin:/usr/local/php/bin
mysql install
Installation dependency ( If you compile and install ) Be careful : MySQL8.0 Need to use gcc The version is 5.3 above
sudo apt install gcc g++ libxml2 libxml2-dev libssl-dev curl libcurl4-openssl-dev libgd-dev
sudo apt install numactl
sudo apt install libaio-dev
sudo apt install cmake
Download binaries Unzip and move
sudo wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.15-linux-glibc2.12-x86_64.tar.xz
sudo xz -d mysql-8.0.15-linux-glibc2.12-x86_64.tar.xz
sudo tar xvf mysql-8.0.15-linux-glibc2.12-x86_64.tar
sudo mv mysql-8.0.15-linux-glibc2.12-x86_64 /usr/local/mysql
add to mysql Users and groups and grant permissions
groupadd mysql
useradd -r -g mysql -s /bin/false mysql
cd /usr/local/mysql
mkdir mysql-files
chown mysql:mysql mysql-files
chmod 750 mysql-files
sudo passwd mysql
Initialization operation
sudo bin/mysqld --initialize --user=mysql
After implementation, it is as follows : ( The second line The last part is Randomly generated passwords )
2022-02-13T12:53:04.809140Z 0 [System] [MY-013169] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.15) initializing of server in progress as process 7638
2022-02-13T12:53:07.799894Z 5 [Note] [MY-010454] [Server] A temporary password is generated for [email protected]localhost: laBnPPN)3dIh
2022-02-13T12:53:09.210107Z 0 [System] [MY-013170] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.15) initializing of server has completed
Copy service file
cp support-files/mysql.server /etc/init.d/mysql.server
Configure boot service
sudo vim /etc/rc.local
# increase mysql Open command
/usr/local/mysql/bin/mysqld_safe --user=mysql &
Add environment variables
sudo vim /etc/profile
# Add the following path
/usr/local/mysql/bin
# Update variables and take effect
source /etc/profile
Turn on mysql The server
bin/mysqld_safe --user=mysql &
Log in with the password you just recorded
bin/mysql -uroot -p
modify root password
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456'
边栏推荐
- R language plot visualization: plot visualization of two-dimensional histogram contour (basic 2D histogram contour)
- IDEA常用插件
- From the perspective of the core competitiveness of ABT, the Internet giant, who fell first
- PostgreSQL division considerations
- Tcp/ip test questions (V)
- Solidity get quarterly time
- Jump jump games auxiliary (manual version) py code implementation
- SEO outsourcing reliable company, enterprise SEO outsourcing company which reliable?
- Overview and trend analysis of China's foreign direct investment industry in 2020 [figure]
- Leetcode-78-subset
猜你喜欢
PostgreSQL user role permissions
Analysis on China's aluminum foil output, trade and enterprise leading operation in 2021: dongyangguang aluminum foil output is stable [figure]
Server journey from scratch - Yu Zhongxian integrated version (IP access server, LNMP compilation and installation, Lua environment and socket expansion)
Gbpnzd firm offer for 14 months, simulation for 19 months, test stable
Web development solution to cross domain problems
QQ机器人:群成员自我禁言管理【最新beta2版本】
Uncover ges super large scale graph computing engine hyg: Graph Segmentation
Principles of MySQL clustered index and non clustered index
ECS 7-day practical training camp (Advanced route) -- day04 -- build a portal using ECs and polardb
Lilda Bluetooth air conditioning receiver helps create a more comfortable road life
随机推荐
Network security detection and prevention test questions (4)
Process of vacuum and vacuum full
DataX script task development record
Mysql database design suggestions
SQL is used for field data types in various databases
Analysis on employment compensation of 2021 college graduates: the average monthly starting salary of doctors, masters, undergraduates and junior colleges is 14823 yuan, 10113 yuan, 5825 yuan and 3910
What should I pay attention to in GoogleSEO content station optimization?
Does GoogleSEO need to change the friend chain? (e6zzseo)
QQ机器人疫情查询/疫情关注等【最新beta2版本】
What is an operator?
Error record: preg_ match(): Compilation failed: range out of order in character class at offset 13
Principles of MySQL clustered index and non clustered index
Analysis on the market scale and pattern of contrast agents in China in 2021: Jiangsu Hengrui pharmaceutical, general electric, Yangzijiang Pharmaceutical Group, Bayer and bleco account for more than
Gbpnzd firm offer for 14 months, simulation for 19 months, test stable
Guangzhou Sinovel interactive VR panorama brings development to all walks of life
Analysis of global tea production, consumption and import and export trade: China's tea production ranks first in the world [figure]
Leetcode-101-symmetric binary tree
想知道新股民怎样炒股票开户?在线开户安全么?
Current situation of China's hydraulic cylinder industry in 2020 (with application fields, policies and regulations, supply and demand status and enterprise pattern) [figure]
二、HikariCP獲取連接流程源碼分析二