当前位置: 首页 > 工具软件 > phpRedisAdmin > 使用案例 >

CentOS 7.6 部署 Apache Nginx PHP MySQL Phpmyadmin Redis phpRedisAdmin

吴浩博
2023-12-01

CentOS 7.6 部署 Apache Nginx PHP MySQL Phpmyadmin Redis phpRedisAdmin

Step 1 更新系统

yum -y update

Step 2 安装 Apache

yum -y install httpd

安装完成后,打开 httpd 的配置文件

vim /etc/httpd/conf/httpd.conf

把 ServerName 前的 # 去掉,并修改为:ServerName localhost 并保存,启动 httpd

service httpd start

浏览器访问服务器IP,可以看到欢迎页面了。说明安装成功

Step 3 安装 MySQL

下载MySQL Yum源

wget https://repo.mysql.com/mysql80-community-release-el7-1.noarch.rpm

下载完成执行下面命令安装MySQL Yum源

yum localinstall mysql80-community-release-el7-1.noarch.rpm

现在可以安装最新版本的MySQL了

yum install mysql-community-server

启动MySQL

service mysqld start

查询MySQL初始化默认密码

grep 'temporary password' /var/log/mysqld.log

比如我这里的结果是

[root@iZ2zebfvkmy1wcs3yeowl8Z ~]# grep 'temporary password' /var/log/mysqld.log
2019-02-24T19:21:59.954017Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: 3D).aNZSw/Lw

初始化MySQL

mysql_secure_installation

[root@iZ2zebfvkmy1wcs3yeowl8Z ~]# mysql_secure_installation

Securing the MySQL server deployment.

Enter password for user root: 
The 'validate_password' component is installed on the server.
The subsequent steps will run with the existing configuration
of the component.
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) : n

 ... skipping.
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) : yes
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! 

Step 4 安装 PHP

安装PHP源

yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

yum -y install epel-release yum-utils

删除PHP5.4的源

yum-config-manager --disable remi-php54

启动PHP7.3的源

yum-config-manager --enable remi-php73

安装PHP7.3

yum -y install php php-cli php-fpm php-mysqlnd php-zip php-devel php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath php-json

安装完成。检查PHP版本 php -v

[root@iZ2zebfvkmy1wcs3yeowl8Z ~]# php -v
PHP 7.3.2 (cli) (built: Feb  5 2019 13:10:03) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.2, Copyright (c) 1998-2018 Zend Technologies

Step 5 安装 Nginx

先关闭 Apache

service httpd stop

CentOS 官方 rpm 源是没有 nginx 安装包的,需要手动添加

cd /etc/yum.repos.d/

vim nginx.repo

往 nginx.repo 文件里添加如下代码

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch
gpgcheck=0
enabled=1

保存后,即可开始安装 Nginx

yum -y install nginx

安装结束后,启动 Nginx

service nginx start

浏览器访问服务器IP,可以看到欢迎页面了。说明安装成功

Step 6 配置 Nginx

vim /etc/nginx/conf.d/default.conf

server {
    listen       80;
    server_name  localhost;

    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;

    location / {
        root   /usr/share/nginx/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   /usr/share/nginx/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  /scripts$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;
    #}
}

解注释掉第24-26行,也就是这行

    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1:8080;
    #}

修改第10行代码,添加index.php

        index  index.php index.html index.htm;

即当 Nginx 接收 http 请求遇到需要解析 php 脚本时,则交给 127.0.0.1:8080 端口来处理,而我们等下配置让 Apache 来监听处理这个端口发来的请求。

Step 7 编辑 Apache 的配置文件

vim /etc/httpd/conf/httpd.conf

找到 Listen 字段,并改为:Listen 127.0.0.1:8080,让 Apache 来监听这个端口,修改 Apache 的网站根目录为:”/usr/share/nginx/html”,与上述 Nginx 对应的网站目录保持一致

找到下面的行,然后按照下面的内容来修改

Listen 127.0.0.1:8080
...
ServerName localhost
...
DocumentRoot "/usr/share/nginx/html"
...
<Directory "/usr/share/nginx/html">
    ...
<⁄Directory>
...

重启 Nginx 服务,并启动 Apache 服务

service nginx restart

service httpd start

chkconfig nginx on

chkconfig httpd on

搞定

备注:

更新Nginx

Step 1 查看原来安装nginx的版本以及编译的参数

nginx -V

[root@iZ2zebfvkmy1wcs3yeowl8Z ~]# nginx -V
nginx version: nginx/1.14.2
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC) 
built with OpenSSL 1.0.2k-fips  26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -pie'

Step 2 下载要升级的nginx版本

wget http://nginx.org/download/nginx-1.15.8.tar.gz

[root@iZ2zebfvkmy1wcs3yeowl8Z ~]# wget http://nginx.org/download/nginx-1.15.8.tar.gz
--2019-02-25 04:14:11--  http://nginx.org/download/nginx-1.15.8.tar.gz
Resolving nginx.org (nginx.org)... 95.211.80.227, 62.210.92.35, 2001:1af8:4060:a004:21::e3
Connecting to nginx.org (nginx.org)|95.211.80.227|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1027862 (1004K) [application/octet-stream]
Saving to: ‘nginx-1.15.8.tar.gz’

100%[=============================================================================================================================>] 1,027,862    210KB/s   in 5.7s   

2019-02-25 04:14:18 (175 KB/s) - ‘nginx-1.15.8.tar.gz’ saved [1027862/1027862]

Step 3 解压ningx下载的压缩包编译make,切记不要make install

tar xf nginx-1.15.8.tar.gz

cd nginx-1.15.8

ls

先做个准备工作

执行yum -y install pcre-devel openssl openssl-devel

复制粘贴Step 1里面的信息,注意,是从--prefix开始的信息

--prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -pie'

在这段信息前面加上./configure,也就是

./configure  --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -pie'

按回车,成功的话,会看到下面的信息

checking for OS
 + Linux 3.10.0-693.2.2.el7.x86_64 x86_64
checking for C compiler ... found
 + using GNU C compiler
 + gcc version: 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) 
checking for gcc -pipe switch ... found
checking for --with-ld-opt="-Wl,-z,relro -Wl,-z,now -pie" ... found
checking for -Wl,-E switch ... found
checking for gcc builtin atomic operations ... found
checking for C99 variadic macros ... found
checking for gcc variadic macros ... found
checking for gcc builtin 64 bit byteswap ... found
checking for unistd.h ... found
checking for inttypes.h ... found
checking for limits.h ... found
checking for sys/filio.h ... not found
checking for sys/param.h ... found
checking for sys/mount.h ... found
checking for sys/statvfs.h ... found
checking for crypt.h ... found
checking for Linux specific features
checking for epoll ... found
checking for EPOLLRDHUP ... found
checking for EPOLLEXCLUSIVE ... not found
checking for O_PATH ... found
checking for sendfile() ... found
checking for sendfile64() ... found
checking for sys/prctl.h ... found
checking for prctl(PR_SET_DUMPABLE) ... found
checking for prctl(PR_SET_KEEPCAPS) ... found
checking for capabilities ... found
checking for crypt_r() ... found
checking for sys/vfs.h ... found
checking for poll() ... found
checking for /dev/poll ... not found
checking for kqueue ... not found
checking for crypt() ... not found
checking for crypt() in libcrypt ... found
checking for F_READAHEAD ... not found
checking for posix_fadvise() ... found
checking for O_DIRECT ... found
checking for F_NOCACHE ... not found
checking for directio() ... not found
checking for statfs() ... found
checking for statvfs() ... found
checking for dlopen() ... not found
checking for dlopen() in libdl ... found
checking for sched_yield() ... found
checking for sched_setaffinity() ... found
checking for SO_SETFIB ... not found
checking for SO_REUSEPORT ... found
checking for SO_ACCEPTFILTER ... not found
checking for SO_BINDANY ... not found
checking for IP_TRANSPARENT ... found
checking for IP_BINDANY ... not found
checking for IP_BIND_ADDRESS_NO_PORT ... not found
checking for IP_RECVDSTADDR ... not found
checking for IP_SENDSRCADDR ... not found
checking for IP_PKTINFO ... found
checking for IPV6_RECVPKTINFO ... found
checking for TCP_DEFER_ACCEPT ... found
checking for TCP_KEEPIDLE ... found
checking for TCP_FASTOPEN ... found
checking for TCP_INFO ... found
checking for accept4() ... found
checking for kqueue AIO support ... not found
checking for Linux AIO support ... found
checking for int size ... 4 bytes
checking for long size ... 8 bytes
checking for long long size ... 8 bytes
checking for void * size ... 8 bytes
checking for uint32_t ... found
checking for uint64_t ... found
checking for sig_atomic_t ... found
checking for sig_atomic_t size ... 4 bytes
checking for socklen_t ... found
checking for in_addr_t ... found
checking for in_port_t ... found
checking for rlim_t ... found
checking for uintptr_t ... uintptr_t found
checking for system byte ordering ... little endian
checking for size_t size ... 8 bytes
checking for off_t size ... 8 bytes
checking for time_t size ... 8 bytes
checking for AF_INET6 ... found
checking for setproctitle() ... not found
checking for pread() ... found
checking for pwrite() ... found
checking for pwritev() ... found
checking for sys_nerr ... found
checking for localtime_r() ... found
checking for clock_gettime(CLOCK_MONOTONIC) ... found
checking for posix_memalign() ... found
checking for memalign() ... found
checking for mmap(MAP_ANON|MAP_SHARED) ... found
checking for mmap("/dev/zero", MAP_SHARED) ... found
checking for System V shared memory ... found
checking for POSIX semaphores ... not found
checking for POSIX semaphores in libpthread ... found
checking for struct msghdr.msg_control ... found
checking for ioctl(FIONBIO) ... found
checking for struct tm.tm_gmtoff ... found
checking for struct dirent.d_namlen ... not found
checking for struct dirent.d_type ... found
checking for sysconf(_SC_NPROCESSORS_ONLN) ... found
checking for sysconf(_SC_LEVEL1_DCACHE_LINESIZE) ... found
checking for openat(), fstatat() ... found
checking for getaddrinfo() ... found
checking for PCRE library ... found
checking for PCRE JIT support ... found
checking for OpenSSL library ... found
checking for zlib library ... found
creating objs/Makefile

Configuration summary
  + using threads
  + using system PCRE library
  + using system OpenSSL library
  + using system zlib library

  nginx path prefix: "/etc/nginx"
  nginx binary file: "/usr/sbin/nginx"
  nginx modules path: "/usr/lib64/nginx/modules"
  nginx configuration prefix: "/etc/nginx"
  nginx configuration file: "/etc/nginx/nginx.conf"
  nginx pid file: "/var/run/nginx.pid"
  nginx error log file: "/var/log/nginx/error.log"
  nginx http access log file: "/var/log/nginx/access.log"
  nginx http client request body temporary files: "/var/cache/nginx/client_temp"
  nginx http proxy temporary files: "/var/cache/nginx/proxy_temp"
  nginx http fastcgi temporary files: "/var/cache/nginx/fastcgi_temp"
  nginx http uwsgi temporary files: "/var/cache/nginx/uwsgi_temp"
  nginx http scgi temporary files: "/var/cache/nginx/scgi_temp"

现在执行make

objs/src/stream/ngx_stream_upstream.o \
objs/src/stream/ngx_stream_upstream_round_robin.o \
objs/src/stream/ngx_stream_write_filter_module.o \
objs/src/stream/ngx_stream_ssl_module.o \
objs/src/stream/ngx_stream_realip_module.o \
objs/src/stream/ngx_stream_limit_conn_module.o \
objs/src/stream/ngx_stream_access_module.o \
objs/src/stream/ngx_stream_geo_module.o \
objs/src/stream/ngx_stream_map_module.o \
objs/src/stream/ngx_stream_split_clients_module.o \
objs/src/stream/ngx_stream_return_module.o \
objs/src/stream/ngx_stream_upstream_hash_module.o \
objs/src/stream/ngx_stream_upstream_least_conn_module.o \
objs/src/stream/ngx_stream_upstream_random_module.o \
objs/src/stream/ngx_stream_upstream_zone_module.o \
objs/src/stream/ngx_stream_ssl_preread_module.o \
objs/ngx_modules.o \
-Wl,-z,relro -Wl,-z,now -pie -ldl -lpthread -lpthread -lcrypt -lpcre -lssl -lcrypto -ldl -lpthread -lz \
-Wl,-E
sed -e "s|%%PREFIX%%|/etc/nginx|" \
	-e "s|%%PID_PATH%%|/var/run/nginx.pid|" \
	-e "s|%%CONF_PATH%%|/etc/nginx/nginx.conf|" \
	-e "s|%%ERROR_LOG_PATH%%|/var/log/nginx/error.log|" \
	< man/nginx.8 > objs/nginx.8
make[1]: Leaving directory `/root/nginx-1.15.8'

Step 4 备份原来老的nginx文件

mv /usr/sbin/nginx /usr/sbin/nginx.bak

cp objs/nginx /usr/sbin/

nginx -t

[root@iZ2zebfvkmy1wcs3yeowl8Z nginx-1.15.8]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Step 5 使用make upgrade替换老的nginx进程

make upgrade

[root@iZ2zebfvkmy1wcs3yeowl8Z nginx-1.15.8]# make upgrade
/usr/sbin/nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
kill -USR2 `cat /var/run/nginx.pid`
sleep 1
test -f /var/run/nginx.pid.oldbin
kill -QUIT `cat /var/run/nginx.pid.oldbin`

最后运行nginx -V来检查nginx版本

[root@iZ2zebfvkmy1wcs3yeowl8Z nginx-1.15.8]# nginx -V
nginx version: nginx/1.15.8
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) 
built with OpenSSL 1.0.2k-fips  26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -pie'

更新完成。

备注:安装Compose

继续安装Redis

Step 1 安装并启用Remi 源

sudo yum install epel-release yum-utils

sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

sudo yum-config-manager --enable remi

Step 2 安装 Redis

yum install redis

[root@iZ2zebfvkmy1wcs3yeowl8Z ~]# sudo yum install redis
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * remi: ftp.riken.jp
 * remi-php73: ftp.riken.jp
 * remi-safe: ftp.riken.jp
remi                                                                                                                                            | 3.0 kB  00:00:00     
remi/primary_db                                                                                                                                 | 2.3 MB  00:00:00     
Resolving Dependencies
--> Running transaction check
---> Package redis.x86_64 0:5.0.3-1.el7.remi will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================================================================================================
 Package                              Arch                                  Version                                          Repository                           Size
=======================================================================================================================================================================
Installing:
 redis                                x86_64                                5.0.3-1.el7.remi                                 remi                                919 k

Transaction Summary
=======================================================================================================================================================================
Install  1 Package

Total download size: 919 k
Installed size: 3.0 M
Is this ok [y/d/N]: y
Downloading packages:
redis-5.0.3-1.el7.remi.x86_64.rpm                                                                                                               | 919 kB  00:00:01     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : redis-5.0.3-1.el7.remi.x86_64                                                                                                                       1/1 
  Verifying  : redis-5.0.3-1.el7.remi.x86_64                                                                                                                       1/1 

Installed:
  redis.x86_64 0:5.0.3-1.el7.remi      

Step 3 启动 Redis

sudo systemctl start redis

sudo systemctl enable redis

[root@iZ2zebfvkmy1wcs3yeowl8Z ~]# sudo systemctl start redis
[root@iZ2zebfvkmy1wcs3yeowl8Z ~]# systemctl enable redis
Created symlink from /etc/systemd/system/multi-user.target.wants/redis.service to /usr/lib/systemd/system/redis.service.

Step 4 检查Redis状态

systemctl status redis

[root@iZ2zebfvkmy1wcs3yeowl8Z ~]# systemctl status redis
● redis.service - Redis persistent key-value database
   Loaded: loaded (/usr/lib/systemd/system/redis.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/redis.service.d
           └─limit.conf
   Active: active (running) since Mon 2019-02-25 05:01:25 CST; 45s ago
 Main PID: 30631 (redis-server)
   CGroup: /system.slice/redis.service
           └─30631 /usr/bin/redis-server 127.0.0.1:6379

Feb 25 05:01:25 iZ2zebfvkmy1wcs3yeowl8Z systemd[1]: Starting Redis persistent key-value database...
Feb 25 05:01:25 iZ2zebfvkmy1wcs3yeowl8Z systemd[1]: Started Redis persistent key-value database.

继续安装phpmyadmin

Step 1 安装EPEL repository源

yum install epel-release

Step 2 安装phpmyadmin

yum install phpmyadmin

Step 3 拷贝phpmyadmin到nginx的web文件夹中

cp -r /usr/share/phpMyAdmin/ /usr/share/nginx/html/

Step 4 登录数据库

mysql -uroot -pROOT密码 需要把ROOT密码替换为你设置的密码

mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 15
Server version: 8.0.15 MySQL Community Server - GPL

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> 

ALTER USER root@localhost IDENTIFIED WITH mysql_native_password BY 'ROOT密码';

浏览器访问服务器IP/phpMyAdmin,可以看到欢迎页面了。说明安装成功

继续安装phpRedisAdmin

curl -sS https://getcomposer.org/installer | php

mv composer.phar /usr/bin/composer

安装phpRedisAdmin

composer create-project -s dev erik-dubbelboer/php-redis-admin /usr/share/phpRedisAdmin

[root@iZ2zebfvkmy1wcs3yeowl8Z html]# composer create-project -s dev erik-dubbelboer/php-redis-admin /usr/share/phpRedisAdmin
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Installing erik-dubbelboer/php-redis-admin (dev-master 6ced4d2aba817c6e8ae1665298e78c60a1f234a3)
  - Installing erik-dubbelboer/php-redis-admin (dev-master 6ced4d2): Cloning 6ced4d2aba
    Failed to download erik-dubbelboer/php-redis-admin from source: Failed to clone https://github.com/erikdubbelboer/phpRedisAdmin.git, git was not found, check that it is installed and in your PATH env.

sh: git: command not found

    Now trying to download from dist
As there is no 'unzip' command installed zip files are being unpacked using the PHP zip extension.
This may cause invalid reports of corrupted archives. Besides, any UNIX permissions (e.g. executable) defined in the archives will be lost.
Installing 'unzip' may remediate them.
  - Installing erik-dubbelboer/php-redis-admin (dev-master 6ced4d2): Loading from cache
Created project in /usr/share/phpRedisAdmin
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
Package operations: 1 install, 0 updates, 0 removals
  - Installing predis/predis (v1.1.1): Loading from cache
predis/predis suggests installing ext-phpiredis (Allows faster serialization and deserialization of the Redis protocol)
Generating autoload files

拷贝到Web目录

cp -r /usr/share/phpRedisAdmin/ /usr/share/nginx/html/

 类似资料: