基于鲲鹏安装LNMP

举报
snowofsummer 发表于 2021/12/24 09:22:49 2021/12/24
【摘要】 1,操作系统版本[root@ecs-01 ~]# [root@ecs-01 ~]# cat /etc/redhat-release CentOS Linux release 7.5.1804 (AltArch) [root@ecs-01 ~]# cat /proc/cpuinfo processor : 0BogoMIPS : 200.00Features : fp asimd evtstr...

1,操作系统版本

[root@ecs-01 ~]# 
[root@ecs-01 ~]# cat /etc/redhat-release 
CentOS Linux release 7.5.1804 (AltArch) 

[root@ecs-01 ~]# cat /proc/cpuinfo 
processor	: 0
BogoMIPS	: 200.00
Features	: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma dcpop asimddp asimdfhm
CPU implementer	: 0x48
CPU architecture: 8
CPU variant	: 0x1
CPU part	: 0xd01
CPU revision	: 0

2,GCC升级

下载地址为https://mirrors.tuna.tsinghua.edu.cn/gnu/gcc/gcc-7.3.0/gcc-7.3.0.tar.gz

2.1解压源码包,命令为:

tar -zxvf gcc-7.3.0.tar.gz

2.2 下载依赖包

[root@ecs-7526 gcc-7.3.0]# ./contrib/download_prerequisites
gmp-6.1.0.tar.bz2: OK
mpfr-3.1.4.tar.bz2: OK
mpc-1.0.3.tar.gz: OK
isl-0.16.1.tar.bz2: OK
All prerequisites downloaded successfully.

2.3编译

[root@ecs-7526 gcc-7.3.0]# mkdir tmp
[root@ecs-7526 gcc-7.3.0]# cd tmp/
[root@ecs-7526 tmp]# ../configure --enable-checking=release --enable-language=c,c++ --disable-multilib  --prefix=/usr

2.4安装

make -j16 
make install

2.5 版本检查

[root@ecs-7526 tmp]# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/aarch64-unknown-linux-gnu/7.3.0/lto-wrapper
Target: aarch64-unknown-linux-gnu
Configured with: ../configure --enable-checking=release --enable-language=c,c++ --disable-multilib --prefix=/usr
Thread model: posix
gcc version 7.3.0 (GCC)

3,mysql安装

3.1 依赖包安装

yum install ncurses*  -y
yum install openssl* -y

3.2 编译安装

cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/data/data \
-DSYSCONFDIR=/etc \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DENABLE_DTRACE=0 \
-DDEFAULT_CHARSET=utf8mb4 \
-DDEFAULT_COLLATION=utf8mb4_general_ci \
-DWITH_EMBEDDED_SERVER=1 \
-DDOWNLOAD_BOOST=1 \
-DWITH_BOOST=/usr/local/src/mysql-5.7.28/boost/boost_1_59_0

3.3 软件安装

make -j16  #根据实际CPU格式指定,相关参数
make install

4.php安装

#编译
./configure --prefix=/usr/local/php7.2.23 --with-mysqli --with-pdo-mysql --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir --enable-simplexml --enable-xml --disable-rpath --enable-bcmath --enable-soap --enable-zip --with-curl --enable-fpm --with-fpm-user=nobody --with-fpm-group=nobody --enable-mbstring --enable-sockets --with-gd --with-openssl --with-mhash --enable-opcache --disable-fileinfo
#安装
make -j16
make install

5,nginx安装

#编译
./configure --with-http_ssl_module
#安装
make -j16
make install

6,mysql建立数据库

6.1新建用户和数据目录,配置环境变量

[root@ecs-7526 ~]# useradd mysql
[root@ecs-7526 ~]# chown mysql:mysql /usr/local/mysql/ -R
[root@ecs-7526 bin]# mkdir -p /data/data
[root@ecs-7526 bin]# mkdir /data/log
[root@ecs-7526 bin]# mkdir /data/run
[root@ecs-7526 bin]# chown mysql:mysql -R /data/
[root@ecs-7526 bin]#export PATH=$PATH:/usr/local/mysql/bin

6.2 初始数据库

//最后一行为数据库,初始化密码:>bDifG;cF3hs

[root@ecs-7526 bin]# ./mysqld --initialize --basedir=/usr/local/mysql --datadir=/data/data --user=mysql
2020-04-25T11:53:34.000475Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-04-25T11:53:34.155506Z 0 [Warning] InnoDB: New log files created, LSN=45790
2020-04-25T11:53:34.196827Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2020-04-25T11:53:34.211330Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 640b31b9-86eb-11ea-97a3-fa163e697b1f.
2020-04-25T11:53:34.214015Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2020-04-25T11:53:34.525712Z 0 [Warning] CA certificate ca.pem is self signed.
2020-04-25T11:53:34.591220Z 1 [Note] A temporary password is generated for root@localhost: >bDifG;cF3hs

6.3 编辑配置文件

修改配置文件 /etc/my.cnf
[mysqld]
datadir=/data/data
socket=/data/data/mysql.sock
[mysqld_safe]
log-error=/data/log/mysql.log
pid-file=/data/run/mysql.pid

6.4 修改root密码

修改密码:
[root@ecs-7526 bin]# ./mysql -uroot -p -S /data/data/mysql.sock
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.28
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> set password=password('root');
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> exit

7,启动PHP

[root@db01 php-7.2.12]# cp php.ini-production /usr/local/php/etc/
[root@db01 php-7.2.12]# cd /usr/local/php/etc/
[root@db01 etc]# ls
php-fpm.conf.default  php-fpm.d  php.ini-production
[root@db01 etc]# cp php-fpm.conf.default php-fpm.conf
[root@db01 etc]# cd php-fpm.d/
[root@db01 php-fpm.d]# ls
www.conf.default
[root@db01 php-fpm.d]# cp www.conf.default www.conf
[root@db01 php-fpm.d]#

启动命令:php-fpm
(./sapi/fpm/init.d.php-fpm  ./init.d.php-fpm start)

8,nginx启动

验证php:
/usr/local/nginx/conf/nginx.conf
//修改如下内容即可:
        location ~ \.php$ {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /usr/local/nginx/html$fastcgi_script_name;
            include        fastcgi_params;
        }


测试页面:
<?
phpinfo()
?>

./nginx -h //帮助
./nginx -s stop //停止
./nginx //启动

【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。