文章目录
服务器基本信息
轻量应用服务器(腾讯云):
Ubuntu 18.04.1 LTS
https://console.cloud.tencent.com/lighthouse/instance
网络:
(公)x.x.x.x
(内)x.x.x.x
账号及密码:
[email protected]/xxxxxxxx
[email protected]/xxxxxxxx
用户管理
# 创建用户
root@VM-4-13-ubuntu:~# adduser team
# 修改密码
team@VM-4-13-ubuntu:~$ sudo passwd root
# 查看用户
root@VM-4-13-ubuntu:~# awk -F':' '{ print $1}' /etc/passwd
# 用户授予和root相同的权限
root@VM-4-13-ubuntu:~# vi /etc/sudoers
team ALL=(ALL:ALL) ALL
# 安装vsftpd
root@VM-4-13-ubuntu:~# apt install vsftpd
远程登录
# 确认开启端口22
(base) ☁ ~ telnet x.x.x.x 22
# 密码登录,默认情况下,root是禁止远程登录的
(base) ☁ ~ ssh [email protected]
# 进入服务器,建立密钥对
➜ ~ ssh-keygen -C "[email protected]"
# 安装公钥
➜ .ssh cat id_rsa.pub >> authorized_keys
➜ .ssh chmod 600 authorized_keys
➜ ~ chmod 700 .ssh
# 设置ssh
➜ ~ sudo vi /etc/ssh/sshd_config
RSAAuthentication yes
PubkeyAuthentication yes
:wq!
# 另外在本配置文件下有如下选项
# 禁止密码登录
PasswordAuthentication no
# 允许root通过ssh登录
PermitRootLogin yes
# 登录本机
➜ ~ ssh localhost
# 远程登录
(base) ☁ ~ ssh -i .ssh/id_rsa [email protected]
# 重启ssh服务
➜ ~ sudo service sshd restart
安装 ohmyzsh
# 安装zsh
team@VM-4-13-ubuntu:~$ sudo apt install zsh
# 安装git
team@VM-4-13-ubuntu:~$ sudo apt install git
# 安装ohmyzsh
team@VM-4-13-ubuntu:~$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
安装并配置MySQL
# 安装mysql server
root@VM-4-13-ubuntu:~# apt install mysql-server
..............
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
....