目录简介系统安装基础配置网络配置服务配置安全加固自动化部署总结1. 简介Ubuntu Server 18.04是一款功能强大、安全稳定的操作系统,适用于各种服务器应用场景。本文将带你从入门到精通,全面...
Ubuntu Server 18.04是一款功能强大、安全稳定的操作系统,适用于各种服务器应用场景。本文将带你从入门到精通,全面掌握Ubuntu Server 18.04。
sudo apt update
sudo apt upgradesudo apt install tree htop git openssh-server net-toolssudo adduser username
sudo passwd usernamesudo systemctl start ssh
sudo systemctl enable sshsudo hostnamectl set-hostname server-name编辑 /etc/netplan/01-netplan.yml 文件:
network: version: 2 ethernets: enp0s3: dhcp4: no addresses: [192.168.1.10/24] gateway4: 192.168.1.1 nameservers: addresses: [8.8.8.8, 8.8.4.4]sudo netplan apply
sudo systemctl restart network-managersudo apt install apache2sudo systemctl status apache2sudo systemctl start apache2sudo systemctl enable apache2sudo apt install mysql-serversudo mysql_secure_installationsudo systemctl status mysqlsudo systemctl start mysqlsudo systemctl enable mysqlsudo systemctl stop postfix
sudo systemctl disable postfixssh-keygen -t rsa -b 4096ssh-copy-id -i ~/.ssh/id_rsa.pub username@server-ipsudo apt install ufwsudo ufw enablesudo ufw allow ssh
sudo ufw allow http
sudo ufw allow httpssudo apt install ansiblesite.yml): hosts: all: hosts: - server-ip become: yes vars: mysql_password: 'your-mysql-password' tasks: - name: Install MySQL apt: name: mysql-server state: present - name: Configure MySQL mysql_db: name: your-database password: "{{ mysql_password }}" state: presentansible-playbook site.yml本文从入门到精通,详细介绍了Ubuntu Server 18.04的安装、配置和安全加固等内容。通过实战教程,希望读者能够掌握Ubuntu Server 18.04的实用技能。