Ubuntu 配置笔记

Ubuntu 配置及相关报错信息记录

nginx

nginx安装

1
2
$ sudo apt update
$ sudo apt install nginx
1
2
$ service nginx status
* nginx is running

配置防火墙

配置防火墙,允许流量通过 HTTP(80)和 HTTPS(443)端口。启用 ‘Nginx Full’ profile,它包含了这两个端口:

1
2
3
4
5
$ sudo ufw allow 'Nginx Full'
Rules updated
Rules updated (v6)
$ sudo ufw status
Status: inactive

浏览器中打开http://YOUR_IP

image-20230625220340380

配置

如何在 Ubuntu 20.04 上安装 Nginx - 知乎 (zhihu.com)

  • 所有的 Nginx 配置文件都在/etc/nginx/目录下。
  • 主要的 Nginx 配置文件是/etc/nginx/nginx.conf

安装Apache

如何在 Ubuntu 18.04 上安装 Apache | linux资讯 (linux265.com)

安装Apache用于http认证

1
2
3
4
5
6
7
8
9
10
11
$ sudo apt install apache2
$ service apache2 status
* apache2 is not running
$ service apache2 start
* Starting Apache httpd web server apache2
(98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
Action 'start' failed.
The Apache error log may have more information.

设置防火墙

1
2
sudo ufw allow 'Apache Full'
sudo ufw allow http

Java8

1
2
sudo apt update
sudo apt install openjdk-8-jdk
1
2
3
4
5
6
7
8
9
10
$ sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).

Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 auto mode
1 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 manual mode
2 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 manual mode

Press <enter> to keep the current choice[*], or type selection number:

ssh

1
2
3
4
5
6
7
8
$ sudo ps -e | grep ssh
$ sudo /etc/init.d/ssh start
sudo: /etc/init.d/ssh: command not found
$ sudo apt-get install openssh-server
$ sudo /etc/init.d/ssh start
* Starting OpenBSD Secure Shell server sshd [ OK ]
$ sudo ps -e | grep ssh
17722 ? 00:00:00 sshd

安装rzsz工具:

1
apt install lrzsz

--THE END--

本文标题:Ubuntu 配置笔记

文章作者:hiyo

文章链接:https://hiyongz.github.io/posts/linux-ubuntu-configure-tutorials/

许可协议:本博客文章除特别声明外,均采用CC BY-NC-ND 4.0 许可协议。转载请保留原文链接及作者。

关注微信公众号,及时接收最新技术文章!