新购买的机器快速配置jdk、nginx、redis等等,使用yum系统自带工具。
openJdk 1.8
查看openJdk可用版本:
命令:
yum list | grep jdk
结果:
copy-jdk-configs.noarch 3.3-11.el7_9 @updates
java-1.8.0-openjdk.x86_64 1:1.8.0.362.b08-1.el7_9 @updates
java-1.8.0-openjdk-devel.x86_64 1:1.8.0.362.b08-1.el7_9 @updates
java-1.8.0-openjdk-headless.x86_64 1:1.8.0.362.b08-1.el7_9 @updates
java-1.6.0-openjdk.x86_64 1:1.6.0.41-1.13.13.1.el7_3 base
java-1.6.0-openjdk-demo.x86_64 1:1.6.0.41-1.13.13.1.el7_3 base
java-1.6.0-openjdk-devel.x86_64 1:1.6.0.41-1.13.13.1.el7_3 base
java-1.6.0-openjdk-javadoc.x86_64 1:1.6.0.41-1.13.13.1.el7_3 base
java-1.6.0-openjdk-src.x86_64 1:1.6.0.41-1.13.13.1.el7_3 base
java-1.7.0-openjdk.x86_64 1:1.7.0.261-2.6.22.2.el7_8 base
java-1.7.0-openjdk-accessibility.x86_64 1:1.7.0.261-2.6.22.2.el7_8 base
java-1.7.0-openjdk-demo.x86_64 1:1.7.0.261-2.6.22.2.el7_8 base
java-1.7.0-openjdk-devel.x86_64 1:1.7.0.261-2.6.22.2.el7_8 base
java-1.7.0-openjdk-headless.x86_64 1:1.7.0.261-2.6.22.2.el7_8 base
java-1.7.0-openjdk-javadoc.noarch 1:1.7.0.261-2.6.22.2.el7_8 base
java-1.7.0-openjdk-src.x86_64 1:1.7.0.261-2.6.22.2.el7_8 base
java-1.8.0-openjdk.i686 1:1.8.0.362.b08-1.el7_9 updates
java-1.8.0-openjdk-accessibility.i686 1:1.8.0.362.b08-1.el7_9 updates
java-1.8.0-openjdk-accessibility.x86_64 1:1.8.0.362.b08-1.el7_9 updates
java-1.8.0-openjdk-demo.i686 1:1.8.0.362.b08-1.el7_9 updates
java-1.8.0-openjdk-demo.x86_64 1:1.8.0.362.b08-1.el7_9 updates
java-1.8.0-openjdk-devel.i686 1:1.8.0.362.b08-1.el7_9 updates
java-1.8.0-openjdk-headless.i686 1:1.8.0.362.b08-1.el7_9 updates
java-1.8.0-openjdk-javadoc.noarch 1:1.8.0.362.b08-1.el7_9 updates
java-1.8.0-openjdk-javadoc-zip.noarch 1:1.8.0.362.b08-1.el7_9 updates
java-1.8.0-openjdk-src.i686 1:1.8.0.362.b08-1.el7_9 updates
java-1.8.0-openjdk-src.x86_64 1:1.8.0.362.b08-1.el7_9 updates
安装jdk 1.8命令:
yum install java-1.8.0-openjdk.x86_64
yum install java-1.7.0-openjdk-devel.x86_64
查看jdk 1.8是否安装成功:
命令:
java -version
结果:
openjdk version "1.8.0_362"
OpenJDK Runtime Environment (build 1.8.0_362-b08)
OpenJDK 64-Bit Server VM (build 25.362-b08, mixed mode)
nginx
查看可用nginx程序:
命令:
yum list | grep nginx
结果:
nginx.x86_64 1:1.20.1-10.el7 @epel
nginx-filesystem.noarch 1:1.20.1-10.el7 @epel
collectd-nginx.x86_64 5.8.1-1.el7 epel
munin-nginx.noarch 2.0.72-1.el7 epel
nginx-all-modules.noarch 1:1.20.1-10.el7 epel
nginx-mod-devel.x86_64 1:1.20.1-10.el7 epel
nginx-mod-http-image-filter.x86_64 1:1.20.1-10.el7 epel
nginx-mod-http-perl.x86_64 1:1.20.1-10.el7 epel
nginx-mod-http-xslt-filter.x86_64 1:1.20.1-10.el7 epel
nginx-mod-mail.x86_64 1:1.20.1-10.el7 epel
nginx-mod-stream.x86_64 1:1.20.1-10.el7 epel
pagure-web-nginx.noarch 5.13.3-2.el7 epel
pcp-pmda-nginx.x86_64 4.3.2-13.el7_9 updates
python2-certbot-nginx.noarch 1.11.0-1.el7 epel
sympa-nginx.x86_64 6.2.70-2.el7 epel
安装nginx命令:
yum install nginx.x86_64
查看nginx版本命令:
命令:
nginx -v
结果:
nginx version: nginx/1.20.1
nginx 文件路径:
/usr/share/nginx/html
nginx 启动命令:
./usr/sbin/nginx -c /etc/nginx/nginx.conf
查看nginx是否启动成功:
命令:
ps -ef | grep nginx
结果:
root 13192 1 0 18:48 ? 00:00:00 nginx: master process ./nginx -c /etc/nginx/nginx.conf
nginx 14009 13192 0 21:04 ? 00:00:00 nginx: worker process
nginx 14010 13192 0 21:04 ? 00:00:00 nginx: worker process
nginx 14011 13192 0 21:04 ? 00:00:00 nginx: worker process
nginx 14012 13192 0 21:04 ? 00:00:00 nginx: worker process
root 14030 13618 0 21:05 pts/1 00:00:00 grep --color=auto nginx
redis
查看可用redis版本:
命令:
yum list | grep redis
结果:
redis.x86_64 3.2.12-2.el7 @epel
collectd-redis.x86_64 5.8.1-1.el7 epel
collectd-write_redis.x86_64 5.8.1-1.el7 epel
hiredis.x86_64 0.12.1-2.el7 epel
hiredis-devel.x86_64 0.12.1-2.el7 epel
opensips-redis.x86_64 1.10.5-4.el7 epel
pcp-pmda-redis.x86_64 4.3.2-13.el7_9 updates
php-nrk-Predis.noarch 1.0.4-1.el7 epel
php-pecl-redis.x86_64 2.2.8-1.el7 epel
php-phpiredis.x86_64 1.0.0-2.el7 epel
python-trollius-redis.noarch 0.1.4-2.el7 epel
python2-django-redis.noarch 4.3.0-1.el7 epel
python2-redis.noarch 2.10.6-2.el7 epel
python3-redis.noarch 2.10.6-2.el7 epel
redis-trib.noarch 3.2.12-2.el7 epel
rubygem-redis.noarch 3.2.1-2.el7 epel
rubygem-redis-doc.noarch 3.2.1-2.el7 epel
syslog-ng-redis.x86_64 3.5.6-3.el7 epel
uwsgi-logger-redis.x86_64 2.0.18-8.el7 epel
uwsgi-router-redis.x86_64 2.0.18-8.el7 epel
安装redis:
yum install redis.x86_64
redis配置文件路径:
/etc/redis.conf
修改配置:
注释掉bind 127.0.0.1 ,默认只能本机连接
修改daemonize的值为yes ,后台启动
修改requirepass ,设置redis服务器的连接密码
启动redis服务:
systemctl start redis
查看redis服务状态:
命令:
systemctl status redis
结果:
● redis.service - Redis persistent key-value database
Loaded: loaded (/usr/lib/systemd/system/redis.service; disabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/redis.service.d
└─limit.conf
Active: active (running) since Fri 2023-03-24 08:37:53 CST; 7min ago
Main PID: 11748 (redis-server)
Tasks: 3
Memory: 4.2M
CGroup: /system.slice/redis.service
└─11748 /usr/bin/redis-server *:6379
测试连接redis服务器:文章来源:https://uudwc.com/A/RqX93
redis-cli -h 127.0.0.1 -p 6379 回车 输入auth指令,接入在配置文件中输入的requirepass的值。登录ok后输入ping,redis服务回复pong
文章来源地址https://uudwc.com/A/RqX93