- A+
所属分类:系统文档
共计 2704 个字符,预计需要花费 7 分钟才能阅读完成。
JDK
更新软件包索引
apt update
检查是否已安装Java
java -version
未安装Java,您将看到以下输出
-bash: java: command not found
安装OpenJDK
sudo apt install default-jre
验证安装
java -version
将看到以下输出
openjdk version "1.8.0_181"
OpenJDK Runtime Environment (build 1.8.0_181-8u181-b13-1~deb9u1-b13)
OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)
Redis
更新本地apt
包缓存并安装Redis
apt update
apt install redis-server
Redis配置文件中将进行一项重要的配置更改,使用首选文本编辑器打开此文件
nano /etc/redis/redis.conf
在文件中,找到该supervised
指令。该supervised
指令默认设置为no
。由于您运行的是使用systemd init系统的Debian,因此将其更改为systemd
. . .
# If you run Redis from upstart or systemd, Redis can interact with your
# supervision tree. Options:
# supervised no - no supervision interaction
# supervised upstart - signal upstart by putting Redis into SIGSTOP mode
# supervised systemd - signal systemd by writing READY=1 to $NOTIFY_SOCKET
# supervised auto - detect upstart or systemd method based on
# UPSTART_JOB or NOTIFY_SOCKET environment variables
# Note: these supervision methods only signal "process is ready."
# They do not enable continuous liveness pings back to your supervisor.
supervised systemd
. . .
重新加载Redis服务文件
systemctl restart redis
检查Redis服务是否正在运行
systemctl status redis
将生成类似于以下内容的输出
● redis-server.service - Advanced key-value store
Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2018-09-05 20:19:44 UTC; 41s ago
Docs: http://redis.io/documentation,
man:redis-server(1)
Process: 10829 ExecStopPost=/bin/run-parts --verbose /etc/redis/redis-server.post-down.d (code=exited, status=0/SUCCESS)
Process: 10825 ExecStop=/bin/kill -s TERM $MAINPID (code=exited, status=0/SUCCESS)
Process: 10823 ExecStop=/bin/run-parts --verbose /etc/redis/redis-server.pre-down.d (code=exited, status=0/SUCCESS)
Process: 10842 ExecStartPost=/bin/run-parts --verbose /etc/redis/redis-server.post-up.d (code=exited, status=0/SUCCESS)
Process: 10838 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf (code=exited, status=0/SUCCESS)
Process: 10834 ExecStartPre=/bin/run-parts --verbose /etc/redis/redis-server.pre-up.d (code=exited, status=0/SUCCESS)
Main PID: 10841 (redis-server)
Tasks: 3 (limit: 4915)
CGroup: /system.slice/redis-server.service
└─10841 /usr/bin/redis-server 127.0.0.1:6379
. . .
测试Redis是否正常运行,请使用命令行客户端连接到服务器
redis-cli
使用以下ping
命令测试连接
ping
PONG
Nginx
更新软件包索引
apt update
安装Nginx软件包
apt install nginx
Nginx服务将在安装过程完成后自动启动。您可以通过运行以下 curl 命令进行验证
curl -I 127.0.0.1
HTTP/1.1 200 OK
Server: nginx/1.10.3
Date: Mon, 27 Aug 2018 22:29:02 GMT
Content-Type: text/html
Content-Length: 612
Last-Modified: Mon, 27 Aug 2018 22:27:54 GMT
Connection: keep-alive
ETag: "5b847aea-264"
Accept-Ranges: bytes
如果使用iptables过滤与系统的连接,则需要打开HTTP(80
)和HTTPS(443
)端口,通过发出以下命令打开必要的端口
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp --dport 443 -j ACCEPT
systemctl管理Nginx服务
systemctl stop nginx
systemctl start nginx
systemctl restart nginx
systemctl reload nginx
systemctl disable nginx
systemctl enable nginx
- 我的微信
- 这是我的微信扫一扫
- 我的微信公众号
- 我的微信公众号扫一扫