Linux环境搭建
系统
配置和宿主机相同网段:
编辑-虚拟网络编辑器,选择VMnet8 NAT模式,可以设置子网和子网掩码,在NAT设置里可以设置网关IP。点击DHCP设置查看DHCP的起始IP地址,设置静态IP时不用这个网段。
虚拟机设置静态IP:建议安装桌面环境在网络设置里配置,略。
VMware中Ubuntu启动卡黑屏:虚拟机设置-显示器,关闭加速3D图形。
# 关闭防火墙
$ sudo ufw disable
# 关闭apparmor
$ sudo systemctl stop apparmor
$ sudo systemctl disable apparmor
安装VMware Tools:
$ sudo apt install open-vm-tools open-vm-tools-desktop
MySQL
安装配置MySQL8.0
# 安装mysql并设置开机自启
$ sudo apt install mysql-server
$ sudo systemctl enable mysql
# 设置密码
$ sudo mysql_secure_installation # 后续根据提示确认即可
$ sudo mysql # 首次无密码
> use mysql
> alter user root@localhost identified with mysql_native_password by 'new_password!'; # 修改root密码
> create user 'test'@'%' identified by 'abc123456'; # 创建新用户
> grant all privileges on *.* to 'test'@'%' with grant option; # 添加授权
> flush privileges;
# 修改服务端配置
$ sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
bind-address = 0.0.0.0
$ sudo systemctl restart mysql
Redis
$ sudo apt install redis
$ sudo vim /etc/redis/redis.conf
# bind 127.0.0.1 #注释掉bind行
protected-mode no # 关闭保护模式
$ sudo systemctl restart redis-server
$ sudo systemctl enable redis-server
ES
ES安装:
https://www.elastic.co/guide/en/elasticsearch/reference/8.14/deb.html
Kibana安装:
https://www.elastic.co/guide/en/kibana/8.14/deb.html
$ wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /usr/share/keyrings/elasticsearch-keyring.gpg
$ sudo apt-get install apt-transport-https
$ echo "deb [signed-by=/usr/share/keyrings/elasticsearch-keyring.gpg] https://artifacts.elastic.co/packages/8.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-8.x.list
$ sudo apt-get update && sudo apt-get install elasticsearch
$ sudo apt-get update && sudo apt-get install kibana
Docker
安装Docker:
$ sudo apt install apt-transport-https ca-certificates curl software-properties-common
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
$ echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
$ sudo apt update
$ sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
修改源:
$ sudo vim /etc/docker/daemon.json
{
"registry-mirrors": [
"https://docker.m.daocloud.io"
]
}
免sudo使用Docker:
$ sudo usermod -aG docker ${USER}