Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0dd689e

Browse files
update
1 parent 7ef583d commit 0dd689e

File tree

1 file changed

+55
-31
lines changed

1 file changed

+55
-31
lines changed

‎_posts/setup-environment/2024-06-22-Tencent-Cloud-Environment-Setup.md

Lines changed: 55 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -26,50 +26,28 @@ ubuntu@ubuntu:~$ sudo vim /etc/hostname
2626
ubuntu@ubuntu:~$ sudo reboot
2727
```
2828

29-
## 防止SSH经常断连
29+
## 调整SSH配置
3030

3131
```bash
32+
# 注意是sshd_config,不是ssh_config
3233
ubuntu@ubuntu:~$ sudo vim /etc/ssh/sshd_config
3334
```
3435

35-
修改或者添加如下内容
36+
修改或者取消注释如下内容
3637

37-
```text
38+
```bash
39+
# 允许root用户登录
40+
PermitRootLogin yes
41+
42+
# 防止SSH经常断连
3843
ClientAliveInterval 30
3944
ClientAliveCountMax 86400
4045
```
4146

4247
```bash
43-
ubuntu@ubuntu:~$ sudo /etc/init.d/ssh restart
48+
ubuntu@ubuntu:~$ sudo service ssh restart
4449
```
4550

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-
7351
## 安装JDK 17
7452

7553
```bash
@@ -217,3 +195,49 @@ war包放到$CATALINA_HOME/webapps/目录下,然后重启tomcat
217195
shutdown.sh; startup.sh ; tail -f $CATALINA_HOME/logs/catalina.out
218196

219197
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

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /