这里写自定义目录标题
- 1 基础配置
- 1.1 安装ifconfig网络管理工具
- 1.2 初始化root密码
- 1.3 换镜像源
- 1.4 关闭息屏休眠
- 1.5 关闭自动更新
- 2 开发环境
- 2.1 go
- 2.1.1 建立软件目录并安装软件
- 2.1.2 建立go工作目录
- 2.1.3 配置环境变量
- 2.2 mysql
- 2.2.1 安装
- 2.2.2 建立对外用户并更改密码
- 2.2.3 修改配置文件运行远程链接
- 2.3 redis
- 2.2.1 安装
- 2.2.2 修改配置文件
- 3 redis简单操作
1 基础配置
1.1 安装ifconfig网络管理工具
选择NAT模式
sudo apt install net-tools
1.2 初始化root密码
sudo passwd root
weiyt@ubuntu:/etc/apt$ sudo passwd root
New password:
Retype new password:
passwd: password updated successfully
然后输入su就可以进入特权模式
1.3 换镜像源
查看ubuntu版本名
lsb_release -c
备份原来的软件源
sudo cp -v /etc/apt/sources.list /etc/apt/sources.list.backup
执行chmod命令更改文件权限使软件源文件可编辑
sudo chmod 777 /etc/apt/sources.list
替换软件源
sudo gedit /etc/apt/sources.list
阿里源
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
清华源
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-proposed main restricted universe multiverse
更新软件列表和软件
sudo apt update
sudo apt upgrade
1.4 关闭息屏休眠
1.5 关闭自动更新
2 开发环境
2.1 go
https://golang.google.cn/doc/install
2.1.1 建立软件目录并安装软件
tar zxvf go1.20.2.linux-amd64.tar.gz -C /usr/local/app
2.1.2 建立go工作目录
mkdir /usr/local/gopro
2.1.3 配置环境变量
gedit /etc/profile
export GO_ROOT=/usr/local/app/go
export GOPATH=/usr/local/gopro
export GOPROXY=https://goproxy.cn #代理
export PATH=$PATH:$GO_ROOT/bin
2.2 mysql
2.2.1 安装
sudo apt-get install -y mysql-server
2.2.2 建立对外用户并更改密码
# 查看初始用户名密码
sudo cat /etc/mysql/debian.cnf
# 登录 mysql
mysql -u debian-sys-maint -p
# 修改 root 密码
use mysql;
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
# 建立用户wyt,密码wyt,并授权
CREATE USER 'wyt'@'%' IDENTIFIED BY 'wyt';
GRANT ALL PRIVILEGES ON *.* TO 'wyt'@'%';
FLUSH PRIVILEGES;
2.2.3 修改配置文件运行远程链接
# 修改 mysql 配置文件
sudo gedit /etc/mysql/mysql.conf.d/mysqld.cnf
#bind-address = 127.0.0.1
#mysqlx-bind-address = 127.0.0.1
2.3 redis
2.2.1 安装
sudo apt-get install -y redis-server
2.2.2 修改配置文件
# 修改 redis 配置文件
sudo gedit /etc/redis/redis.conf
#bind 127.0.0.1 ::1
requirepass 123456
3 redis简单操作
redis-cli
auth 123456
select 0
keys *
set amy 10 # 赋值
get amy # 取值
del amy # 删除