@@ -26,50 +26,28 @@ ubuntu@ubuntu:~$ sudo vim /etc/hostname
26
26
ubuntu@ubuntu:~ $ sudo reboot
27
27
```
28
28
29
- ## 防止SSH经常断连
29
+ ## 调整SSH配置
30
30
31
31
``` bash
32
+ # 注意是sshd_config,不是ssh_config
32
33
ubuntu@ubuntu:~ $ sudo vim /etc/ssh/sshd_config
33
34
```
34
35
35
- 修改或者添加如下内容
36
+ 修改或者取消注释如下内容
36
37
37
- ``` text
38
+ ``` bash
39
+ # 允许root用户登录
40
+ PermitRootLogin yes
41
+
42
+ # 防止SSH经常断连
38
43
ClientAliveInterval 30
39
44
ClientAliveCountMax 86400
40
45
```
41
46
42
47
``` bash
43
- ubuntu@ubuntu:~ $ sudo /etc/init.d/ ssh restart
48
+ ubuntu@ubuntu:~ $ sudo service ssh restart
44
49
```
45
50
46
- ## 安装JDK 8
47
-
48
- ``` bash
49
- ubuntu@ubuntu:/usr/local$ sudo mkdir java
50
- ubuntu@ubuntu:/usr/local$ sudo chown ubuntu:ubuntu java
51
- ```
52
-
53
- 上传jdk-8u371-linux-x64.tar.gz到java目录
54
-
55
- ubuntu@ubuntu:/usr/local$ cd java/
56
- ubuntu@ubuntu:/usr/local/java$ tar -zxvf jdk-8u371-linux-x64.tar.gz
57
-
58
- ubuntu@ubuntu:/usr/local/java $ cd
59
- ubuntu@ubuntu:~ $ sudo vim /etc/profile
60
-
61
- 在文件末尾添加如下内容:
62
-
63
- export JAVA_HOME=/usr/local/java/jdk1.8.0_371
64
- export CLASSPATH=.:$JAVA_HOME/lib:$CLASSPATH
65
- export PATH=$JAVA_HOME/bin:$PATH
66
-
67
- ubuntu@ubuntu:~ $ source /etc/profile
68
- ubuntu@ubuntu:~ $ java -version
69
- java version "1.8.0_371"
70
- Java(TM) SE Runtime Environment (build 1.8.0_371-b11)
71
- Java HotSpot(TM) 64-Bit Server VM (build 25.371-b11, mixed mode)
72
-
73
51
## 安装JDK 17
74
52
75
53
``` bash
@@ -217,3 +195,49 @@ war包放到$CATALINA_HOME/webapps/目录下,然后重启tomcat
217
195
shutdown.sh; startup.sh ; tail -f $CATALINA_HOME/logs/catalina.out
218
196
219
197
http://124.222.145.48:8080/java-web-test/index.jsp
198
+
199
+ ## 安装Apache
200
+
201
+ 安装Apache作为HTTP文件下载服务器
202
+
203
+ ``` bash
204
+ ubuntu@ubuntu:~ $ sudo apt-get install apache2
205
+ ```
206
+
207
+ 尝试启动Apache2服务
208
+
209
+ ``` bash
210
+ ubuntu@ubuntu:~ $ /etc/init.d/apache2 start
211
+ Starting apache2 (via systemctl): apache2.service==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
212
+ Authentication is required to start ' apache2.service' .
213
+ Authenticating as: qcloud (ubuntu)
214
+ Password:
215
+ ==== AUTHENTICATION COMPLETE ===
216
+ .
217
+ ```
218
+
219
+ 直接访问< http://124.222.145.48:80/ > ,既可看到对应的Apache2默认页面。
220
+
221
+ ![ ] ( https://raw.githubusercontent.com/jiangxincode/PicGo/master/2025-07-26_12-25-59.png )
222
+
223
+ 存放的目录为` /var/www/html/ ` ,想要下载的文件直接放到这个目录下,然后直接访问既可。
224
+
225
+ < http://124.222.145.48/download/ >
226
+
227
+ ``` bash
228
+
229
+ 命令汇总
230
+
231
+ ` ` ` bash
232
+ # 启动Apache2服务
233
+ /etc/init.d/apache2 start
234
+
235
+ # 查看Apache2服务状态
236
+ /etc/init.d/apache2 status
237
+
238
+ # 停止Apache2服务
239
+ /etc/init.d/apache2 stop
240
+
241
+ # 重启Apache2服务
242
+ /etc/init.d/apache2 restart
243
+ ` ` `
0 commit comments