帝王谷资源网 Design By www.wdxyy.com

简单说明

由于之前是用Centos7搭建的,后来使用ubuntu 20.04的系统做为个人开发环境,所以想在ubuntu上也搭建一下环境,和Centos有一些小区别所以记录一下仅供学习。

安装前准备

下载软件:
php:7.3.18
nginx:1.18.0
mariadb:10.5.4

解压文件:

tar zxf php-7.3.18.tar.gz
tar zxf mariadb-10.5.4.tar.gz
tar zxf nginx-1.18.0.tar.gz

ubuntu 20.04上搭建LNMP环境的方法步骤

安装Nginx

sudo groupadd -r nginx && sudo useradd -r -g nginx -s /sbin/nologin -d /usr/local/nginx nginx
sudo apt install -y libpcre3-dev zlib1g-dev
cd /home/allen/下载/nginx-1.18.0
./configure --user=nginx --group=nginx
make -j 4 && sudo make install
sudo /usr/local/nginx/sbin/nginx -t
#nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
#nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
sudo mv /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf.back
sudo vim /usr/local/nginx/conf/nginx.conf

user nginx;
worker_processes 4;
events {
  worker_connections 1024;
}
http {
  include    mime.types;
  default_type application/octet-stream;
  sendfile   on;
  keepalive_timeout 65;
  log_format main '$remote_addr || $remote_user || $time_local || $request || $status || $body_bytes_sent || $http_referer || $http_user_agent || $http_x_forwarded_for';
  include /data/www/*/*.conf;
} 

sudo chown -R nginx:nginx /usr/local/nginx

sudo vim /lib/systemd/system/nginx.service

[Unit]
Description=nginx
After=network.target

[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s quit
PrivateTmp=true

[Install]
WantedBy=multi-user.target


sudo systemctl enable nginx

#Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /lib/systemd/system/nginx.service.

reboot

重启后看看有没有启动成功

ubuntu 20.04上搭建LNMP环境的方法步骤

安装Mariadb

sudo rm -rf /etc/mysql
sudo apt remove -y mysql-common
sudo apt autoremove -y
sudo apt install -y cmake libncurses5-dev libgnutls28-dev
sudo groupadd -r mysql && sudo useradd -r -g mysql -s /sbin/nologin -d /usr/local/mariadb mysql
sudo mkdir -p /data/db /var/log/mariadb
cd /home/allen/下载/mariadb-10.5.4/
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mariadb -DMYSQL_DATADIR=/data/db -DSYSCONFDIR=/etc -DWITHOUT_TOKUDB=1 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8mb4 -DDEFAULT_COLLATION=utf8mb4_general_ci
make -j 4 && sudo make install
sudo /usr/local/mariadb/scripts/mysql_install_db --user=mysql --datadir=/data/db
sudo vim /etc/my.cnf

[mysqld]
datadir = /data/db
socket = /tmp/mysql.sock
# 建议禁用符号链接,防止各类安全风险
symbolic-links = 0
collation-server = utf8mb4_general_ci
init-connect = 'SET NAMES utf8mb4'
character-set-server = utf8mb4

[mysql]
default-character-set = utf8mb4

[client]
port = 3306
socket = /tmp/mysql.sock
default-character-set = utf8mb4

[mysqld_safe]
log-error = /var/log/mariadb/mariadb.log
pid-file = /var/run/mariadb/mariadb.pid

sudo cp /usr/local/mariadb/support-files/mysql.server /etc/init.d/mariadb

sudo vim /etc/profile.d/mariadb.sh
export PATH=$PATH:/usr/local/mariadb/bin/

sudo chmod 0777 /etc/profile.d/mariadb.sh
source /etc/profile.d/mariadb.sh

sudo /etc/init.d/mariadb start
#Starting mariadb (via systemctl): mariadb.service.

sudo /usr/local/mariadb/bin/mysql_secure_installation 	 

#NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
#   SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

#In order to log into MariaDB to secure it, we'll need the current
#password for the root user. If you've just installed MariaDB, and
#haven't set the root password yet, you should just press enter here.

#Enter current password for root (enter for none): 
#OK, successfully used password, moving on...

#Setting the root password or using the unix_socket ensures that nobody
#can log into the MariaDB root user without the proper authorisation.

#You already have your root account protected, so you can safely answer 'n'.

#Switch to unix_socket authentication [Y/n] y
#Enabled successfully!
#Reloading privilege tables..
# ... Success!


#You already have your root account protected, so you can safely answer 'n'.

#Change the root password"text-align: center">ubuntu 20.04上搭建LNMP环境的方法步骤

安装PHP

sudo apt install -y libxml2-dev libssl-dev libbz2-dev libcurl4-gnutls-dev libjpeg-dev libpng-dev pkg-config libxslt1-dev libzip-dev libfreetype6-dev libfontconfig1-dev autoconf
sudo groupadd -r php && sudo useradd -r -g php -s /sbin/nologin -d /usr/local/php php
sudo vim /etc/sudoers
php   ALL=(ALL:ALL) ALL
cd /home/allen/下载/php-7.3.18/


./configure --prefix=/usr/local/php \--exec-prefix=/usr/local/php --with-fpm-user=php --with-fpm-group=php --enable-zip --with-curl --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-mysqli --with-openssl --with-pdo-mysql --with-pdo-sqlite --with-pear --with-xmlrpc --with-xsl --with-zlib --with-bz2 --with-mhash --enable-bcmath --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-sysvshm --enable-xml --enable-fpm --with-freetype-dir --with-gd --with-libxml-dir --with-pcre-regex --enable-libxml --enable-zip --with-png-dir --with-jpeg-dir

有一个错误:

configure: error: freetype-config not found.

解决办法:
据说:https://www.doopsky.com/ops/981.html

这是由于在 Ubuntu 19.04 中 apt-get 安装的 libfreetype6-dev 版本为 2.9.1-3
http://changelogs.ubuntu.com/changelogs/pool/main/f/freetype/freetype_2.9.1-3/changelog
在 changelog 中写到:

The `freetype-config' script is no longer installed by default
(Closes: #871470, #886461). All packages depending on libfreetype6-dev
should use pkg-config to find the relevant CFLAGS and libraries.
freetype-config 被替代成 pkg-config ,新版本使用 pkg-config 管理 CFLAGS 和 库。

所以解决方法如下:
主要的思路就是用pkg-config代替freetype-config。安装pkg-config,我在上面已经安装了

cat ./configure | grep "freetype-config" -n
34847:   if test -f "$i/bin/freetype-config"; then
34849:    FREETYPE2_CONFIG="$i/bin/freetype-config"
34855:   as_fn_error $"freetype-config not found." "$LINENO" 5
36568:   if test -f "$i/bin/freetype-config"; then
36570:    FREETYPE2_CONFIG="$i/bin/freetype-config"
36576:   as_fn_error $"freetype-config not found." "$LINENO" 5

sed -i "s/freetype-config/pkg-config/g" ./configure
cat ./configure | grep "FREETYPE2_CONFIG --cflags" -n
34858:  FREETYPE2_CFLAGS=`$FREETYPE2_CONFIG --cflags`
36579:  FREETYPE2_CFLAGS=`$FREETYPE2_CONFIG --cflags`

sed -i "s/FREETYPE2_CONFIG --cflags/FREETYPE2_CONFIG freetype2 --cflags/g" ./configure
cat ./configure | grep "FREETYPE2_CONFIG --libs" -n 
34859:  FREETYPE2_LIBS=`$FREETYPE2_CONFIG --libs`
36580:  FREETYPE2_LIBS=`$FREETYPE2_CONFIG --libs`

sed -i "s/FREETYPE2_CONFIG --libs/FREETYPE2_CONFIG freetype2 --libs/g" ./configure
cat ./ext/gd/config.m4 | grep "freetype-config" -n
188:   if test -f "$i/bin/freetype-config"; then
190:    FREETYPE2_CONFIG="$i/bin/freetype-config"
196:   AC_MSG_ERROR([freetype-config not found.])

sed -i "s/freetype-config/pkg-config/g" ./ext/gd/config.m4

重新编译安装就OK

Thank you for using PHP.

make -j 4 && sudo make install

sudo cp php.ini-production /usr/local/php/lib/php.ini

sudo cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

sudo cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf

vim /usr/local/php/etc/php-fpm.d/www.conf
listen.mode = 0666
pm.max_children = 128
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 10000
slowlog = log/$pool.log.slow
rlimit_files = 1024

sudo vim /etc/profile.d/php.sh
export PATH=$PATH:/usr/local/php/bin/

sudo chmod 0777 /etc/profile.d/php.sh && source /etc/profile.d/php.sh

sudo cp sapi/fpm/php-fpm.service /etc/systemd/system/php.service

安装xdebug

下载xdebug http://pecl.php.net/get/xdebug-2.9.6.tgz

cd /home/allen/下载
tar zxf xdebug-2.9.6.tgz
cd xdebug-2.9.6
phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make -j 4 && sudo make install

安装Apcu

下载Apcu http://pecl.php.net/get/apcu-5.1.18.tgz

cd /home/allen/下载
tar zxf apcu-5.1.18.tgz
cd apcu-5.1.18
phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make -j 4 && sudo make install

编辑PHP.INI

sudo 
vim /usr/local/php/lib/php.ini

date.timezone = Asia/Shanghai
expose_php = off
max_execution_time = 0
memory_limit = 4096M
display_errors = On
cgi.fix_pathinfo=0
extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20180731/"
extension=pgsql
extension=apcu

zend_extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20180731/xdebug.so
[xdebug]
xdebug.var_display_max_children=10240
xdebug.var_display_max_data=20480
xdebug.var_display_max_depth=50

启动

sudo systemctl enable php-fpm

sudo chown -R mysql:mysql /usr/local/mariadb
sudo chown -R nginx:nginx /usr/local/nginx
sudo chown -R php:php /usr/local/php
reboot 

ubuntu 20.04上搭建LNMP环境的方法步骤

标签:
ubuntu,20.04搭建LNMP,ubuntu,20.04搭建LNMP环境

帝王谷资源网 Design By www.wdxyy.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
帝王谷资源网 Design By www.wdxyy.com

《魔兽世界》大逃杀!60人新游玩模式《强袭风暴》3月21日上线

暴雪近日发布了《魔兽世界》10.2.6 更新内容,新游玩模式《强袭风暴》即将于3月21 日在亚服上线,届时玩家将前往阿拉希高地展开一场 60 人大逃杀对战。

艾泽拉斯的冒险者已经征服了艾泽拉斯的大地及遥远的彼岸。他们在对抗世界上最致命的敌人时展现出过人的手腕,并且成功阻止终结宇宙等级的威胁。当他们在为即将于《魔兽世界》资料片《地心之战》中来袭的萨拉塔斯势力做战斗准备时,他们还需要在熟悉的阿拉希高地面对一个全新的敌人──那就是彼此。在《巨龙崛起》10.2.6 更新的《强袭风暴》中,玩家将会进入一个全新的海盗主题大逃杀式限时活动,其中包含极高的风险和史诗级的奖励。

《强袭风暴》不是普通的战场,作为一个独立于主游戏之外的活动,玩家可以用大逃杀的风格来体验《魔兽世界》,不分职业、不分装备(除了你在赛局中捡到的),光是技巧和战略的强弱之分就能决定出谁才是能坚持到最后的赢家。本次活动将会开放单人和双人模式,玩家在加入海盗主题的预赛大厅区域前,可以从强袭风暴角色画面新增好友。游玩游戏将可以累计名望轨迹,《巨龙崛起》和《魔兽世界:巫妖王之怒 经典版》的玩家都可以获得奖励。