设置root初始密码:sudo passwd root
ROOT登录:sudo loign
查看进程:ps -ef
查看指定进程:ps -ef | grep 程序名
查看CPU占用:htop
查看端口占用:netstat -lntp | grep 6379
服务器端: sudo apt-get install openssh-server
使用端: sudo apt-get install openssh-client
服务器端配置:sudo vim /etc/ssh/sshd_config
允许远程ROOT登录: PermitRootLogin yes
端口:Port 39761
重启SSH:systemctl restart sshd.service
安装防火墙 :sudo apt-get install ufw
启用:sudo ufw enable (关闭)
设置白名单模式:sudo ufw default deny
关闭:sudo ufw disable
查看状态:sudo ufw status
允许端口:sudo ufw allow 80(允许外部访问80端口)
禁止端口:sudo ufw delete allow 80 (禁止外部访问80 端口)
允许SSH端口:sudo ufw allow 39761(就是上面的自定义端口)
安装net-tools工具:sudo apt install net-tools
查看IP:ifconfig -a
编辑配置:vim /etc/netplan/00-installer-config-wifi.yaml (这里是WIFI连接)
# This is the network config written by 'subiquity'
network:
version: 2
wifis:
wlp3s0:
access-points:
WIFI名字:
password: 'WIFI密码'
addresses: [10.168.2.250/24]
dhcp4: no
optional: true
gateway4: 10.168.2.1
nameservers:
addresses: [10.168.2.1,8.8.8.8,114.114.114.114]
重启网络:sudo netplan apply
查看:ifconfig -a
测试:ping 10.168.2.1
在线安装:sudo apt-get install mysql-server
初始化配置:sudo mysql_secure_installation
允许端口:sudo ufw allow 3306
配置远程访问:sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
bind-address = 0.0.0.0
重启MySql:sudo /etc/init.d/mysql restart
登录MySql:sudo mysql -uroot -p
设置root远程访问:
mysql>use mysql;
查看用户表:mysql>select User,authentication_string,Host from user;
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '密码';
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '密码' PASSWORD EXPIRE NEVER;
mysql> UPDATE user SET host = '%' WHERE user = 'root';
mysql>flush privileges;
mysql>quit;
更改数据库目录:Ubuntu 中修改 MySQL 数据库存储数据的位置_之一先生专栏-CSDN博客
参考:Ubuntu20.04安装Mysql_風の住む街~的博客-CSDN博客_ubuntu20.04安装mysql
在线安装:sudo apt install openjdk-8-jdk-headless (如果不知道要安装的名称,可直接javac -version,然后就会提示所有可安装的版本)
查看版本:java -version
参考:ubuntu 安装 Java 开发环境 - schips - 博客园
在线安装:apt-get install nginx
配置:vim /etc/nginx/nginx.conf
启动:systemctl start nginx
开机自动启动nginx 服务:sudo systemctl enable nginx
关闭开机自动启动nginx 服务:sudo systemctl disable nginx
配置可后台运行:vim /etc/redis/redis.conf: daemonize yes
运行: #: redis
查看是否在运行:ps -ef | grep redis
设置远程连接:
- sudo vim /etc/redis/redis.conf:
- 把bind 127.0.0.1 ::1改成#bind 127.0.0.1 ::1
- daemonize no
- protected-mode no
- 参考https://blog.csdn.net/java_mdzy/article/details/89221510
重启服务:/etc/init.d/redis-server restart
设置密码:127.0.0.1:6379> CONFIG set requirepass "pwd"
登录:127.0.0.1:6379> AUTH "pwd"
参考:www.runoob.com/redis/redis-security.html