-CentOS7_aarch64安装Chemex资产管理系统

CentOS7_aarch64安装Chemex资产管理系统

hades 54天前 226

一、环境介绍

操作系统:CentOS Linux release 7.7.1908 (AltArch)
内核版本: 4.18.0-80.7.2.el7.aarch64
操作系统最小化安装即可,系统安装完成后关闭SElinux、防火墙,安装开发工具。
硬件配置:8核cpu,16G内存,50G硬盘

二、安装部署

2.1 安装数据库

数据库安装可以使用yum直接安装。

# 卸载系统自带的mariadb-libs
yum remove mariadb-libs -y
# 添加maraidb的yum源
[root@localhost yum.repos.d]# cat maraidb.repo
[mariadb]
name=maraidb
baseurl=https://mirrors.tuna.tsinghua.edu.cn/mariadb/yum/10.5/centos7-aarch64/
enabled=1
gpgcheck=0
# 安装MariaDB
yum install  MariaDB-server -y
systemctl start mariadb && systemctl enable mariadb

安装完成后使用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] n #是否切换为通过socket认证
 ... skipping.

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

Change the root password? [Y/n] Y #是否修改root密码
New password: #输入新密码
Re-enter new password: #再次输入新密码
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB 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? [Y/n] 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? [Y/n] Y #关闭root远程访问
 ... Success!

By default, MariaDB 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? [Y/n] n # 移除测试库
 ... skipping.

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y #权限刷新
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!
[root@localhost yum.repos.d]#

2.2 安装php

1、安装需要的lib库;

yum install libxml* krb* openssl* sqlite* bzip* libcurl*  libpng* libxslt*  libjpeg* libicu-devel gd-devel httpd-devel -y
wget https://download-ib01.fedoraproject.org/pub/epel/7/aarch64/Packages/o/oniguruma-devel-5.9.5-3.el7.aarch64.rpm
wget https://download-ib01.fedoraproject.org/pub/epel/7/aarch64/Packages/o/oniguruma-5.9.5-3.el7.aarch64.rpm
rpm -ivh oniguruma*

2、安装cmake

wget https://cmake.org/files/v3.5/cmake-3.5.2.tar.gz
tar zxvf cmake-3.5.2.tar.gz
cd cmake-3.5.2/
./bootstrap
make -j
make install
cmake --version

3、安装libzip库、openldap库、libtidy库

wget https://libzip.org/download/libzip-1.8.0.tar.gz
tar -zxvf libzip-1.8.0.tar.gz
cd libzip-1.8.0/
mkdir build
cd build/
cmake ..
make -j
make install

yum install openldap*
ln -sv /lib64/libldap* /usr/lib/

wget https://download-ib01.fedoraproject.org/pub/epel/7/aarch64/Packages/l/libtidy-5.4.0-1.el7.aarch64.rpm
wget https://download-ib01.fedoraproject.org/pub/epel/7/aarch64/Packages/l/libtidy-devel-5.4.0-1.el7.aarch64.rpm
 rpm -ivh libtidy-*

4、修改动态库加载配置文件

[root@localhost libzip-1.8.0]# cat /etc/ld.so.conf
include ld.so.conf.d/*.conf
/usr/local/lib/
/usr/local/lib64/
[root@localhost build]# ldconfig

5、创建www用户和组

groupadd www
useradd -g www www

6、下载php8,解压后修改Zend/zend_operators.h文件中ZEND_USE_ASM_ARITHMETIC值均为0。

wget https://www.php.net/distributions/php-8.0.11.tar.gz
tar -zxvf php-8.0.11.tar.gz
cd php-8.0.11
6e19e37cec2641afd157124b3bf335ab.png


执行configure命令;

export PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig/
./configure --prefix=/usr/local/php --with-apxs2=/usr/bin/apxs --with-config-file-path=/usr/local/php/etc --with-fpm-user=www --with-fpm-group=www --enable-fpm --enable-mysqlnd --enable-opcache --enable-pcntl --enable-mbstring --enable-soap --with-zip --enable-calendar --enable-bcmath --enable-exif --enable-ftp --enable-intl --with-mysqli --with-pdo-mysql --with-openssl --with-curl --enable-gd --with-gettext --with-mhash --with-openssl --with-tidy --with-zlib --with-ldap

以上完成后在PHP源码目录下 vi Makefile 找到 EXTRA_LIBS 行,在行末添加 ‘ -llber ‘ 保存退出。

6257bb8a318d3c8407f9ad0186b12f13.png


执行make -j进行编译,make install安装。
修改/etc/profile将php的bin目录添加到环境变量。

7、添加配置文件和启动脚本

ln -s /usr/local/php/sbin/php-fpm /usr/local/php/bin/php-fpm
# 切换到php源码目录cd php-8.0.11
cp php.ini-production /usr/local/php/etc/php.ini
# 切换到/usr/local/php/etc中
cp php-fpm.conf.default php-fpm.conf
cp php-fpm.d/www.conf.default php-fpm.d/www.conf

修改php-fpm.conf将17行注释打开,修改pid文件路径如下:

7a26c74d062b242ea5d2eb3f80728252.png


修改php.ini文件,将memory_limit改为-1,如下:

d5abffb0adc07862fa4ff0156be67ddb.png

通过如下命令启动php:

nohup /usr/local/php/sbin/php-fpm --nodaemonize --fpm-config /usr/local/php/etc/php-fpm.conf &

2.3 安装nginx

1、安装PCRE

wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.tar.gz
tar -zxvf pcre-8.36.tar.gz
cd pcre-8.36
./configure
make && make install

2、安装zlib库

wget http://zlib.net/zlib-1.2.11.tar.gz
tar -zxvf zlib-1.2.11.tar.gz
./configure
make && make install

3、安装nginx

wget http://nginx.org/download/nginx-1.8.0.tar.gz
tar -zxvf nginx-1.8.0.tar.gz
cd nginx-1.8.0
./configure --user=nobody --group=nobody --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_gzip_static_module --with-http_realip_module --with-http_sub_module --with-http_ssl_module
make && make install

启动:
/usr/local/nginx/sbin/nginx
重启:
/usr/local/nginx/sbin/nginx -s reload
停止:
/usr/local/nginx/sbin/nginx -s stop
测试配置文件是否正常:
/usr/local/nginx/sbin/nginx -t

2.4 部署Chemex

1、安装Composer

curl -k  https://install.phpcomposer.com//download/2.1.9/composer.phar -o composer.phar
cp composer.phar /usr/local/bin/composer
chmod 777 /usr/local/bin/composer

2、下载Chemex

cd /var/www/html/
git clone https://gitee.com/dcat-phper/chemex.git

3、在项目根目录中,复制 .env.example 文件为一份新的,并重命名为 .env;
4、修改.env中的数据库配置,如图:

0dc5e2f2a7972dd60c14fe347d3118ab.png

5、在数据库中创建chemex数据库(create database chemex;);
6、在项目根目录执行composer更新命令

composer update -vvv --ignore-platform-reqs

7、将bootstrap和storage授予777权限;
8、在项目根目录执行安装命令

[root@localhost chemex]# php artisan chemex:install
正在优化配置!
Cached events cleared!
Compiled views cleared!
Application cache cleared!
Route cache cleared!
Configuration cache cleared!
Compiled services and packages files removed!
Caches cleared successfully!
正在设置存储系统!
The [/var/www/html/chemex/public/storage] link has been connected to [/var/www/html/chemex/storage/app/public                                                                            ].
The links have been created.
正在配置APP密钥!
Application key set successfully.
正在配置JWT密钥!

 This will invalidate all existing tokens. Are you sure you want to override the secret key? (yes/no) [no]:
 > yes

jwt-auth secret [JcllI2CmzniJOPvoaYa0Fd8idwnsPhV45jHvCsXPvnw1yH4tUXcK1ExlXEszcofG] set successfully.
正在处理数据库迁移!
Migration table created successfully.
Migrating: 2016_01_04_173148_create_admin_tables
Migrated:  2016_01_04_173148_create_admin_tables (108.40ms)
Migrating: 2020_09_07_090635_create_admin_settings_table
Migrated:  2020_09_07_090635_create_admin_settings_table (16.23ms)
Migrating: 2020_09_22_015815_create_admin_extensions_table
Migrated:  2020_09_22_015815_create_admin_extensions_table (24.90ms)
Migrating: 2020_11_01_083237_update_admin_menu_table
Migrated:  2020_11_01_083237_update_admin_menu_table (3.45ms)
Migrating: 2021_03_24_213912_version_3_0_0
Migrated:  2021_03_24_213912_version_3_0_0 (234.02ms)
Migrating: 2021_04_02_085513_version_3_0_1
Migrated:  2021_04_02_085513_version_3_0_1 (20.29ms)
Migrating: 2021_04_03_085513_version_3_0_2
Migrated:  2021_04_03_085513_version_3_0_2 (22.88ms)
Migrating: 2021_05_19_085513_version_3_0_10
Migrated:  2021_05_19_085513_version_3_0_10 (9.82ms)
Migrating: 2021_09_09_214313_version_3_2
Migrated:  2021_09_09_214313_version_3_2 (15.83ms)
Migrating: 2021_09_27_194135_version_3_2_1
Migrated:  2021_09_27_194135_version_3_2_1 (0.95ms)
Migrating: 2021_10_15_091340_version_3_3_0
Migrated:  2021_10_15_091340_version_3_3_0 (9.38ms)
正在初始化基础数据!
Database seeding completed successfully.
Database seeding completed successfully.
Database seeding completed successfully.
Database seeding completed successfully.
Database seeding completed successfully.
Database seeding completed successfully.
Database seeding completed successfully.
Database seeding completed successfully.
Database seeding completed successfully.
Database seeding completed successfully.
Database seeding completed successfully.
Database seeding completed successfully.
Database seeding completed successfully.
Database seeding completed successfully.
Database seeding completed successfully.
Admin账户已成功重置为 admin/admin
安装完成!
用户名密码都为:admin

9、修改nginx配置文件如下:

server {
        listen       80;
        index   index.php index.html;
        root     /var/www/html/chemex/public/;
        #server_name  localhost;
        try_files $uri $uri/ /index.php?$args;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        #location / {
        #    root   html;
        #    index  index.html index.htm;
        #}

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /var/www/html/chemex/public/$fastcgi_script_name;
            include        fastcgi_params;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }

10、打开浏览器访问http://IP地址,用户名密码都是为admin。

最新回复 (0)
返回
发新帖
0