2.网络配置
1) 配置静态ip
实现ping一下待使用的ip,然后使用如下命令进行修改:
auto enp0s3
iface enp0s3 inet static
address 192.168.1.125
netmask 255.255.255.0
gateway 192.168.1.1
最后使用如下命令
sudo /etc/init.d/networking restart
2)配置访问外网
把VM setting下的network选项改成网桥模式
3)配置某个端口可以被外部访问
sudo iptables -I INPUT -p tcp --dport 1250 -j ACCEPT
sudo iptables-save
sudo netfilter-persistent save(这时如果提示无法识别netfilter-persistent命令,使用sudo apt-get install
netfilter-persistent 进行安装即可)
sudo netfilter-persistent save
sudo netfilter-persistent reload
4) 使用git 命令上传code
a.首先保证VM能够访问外网:给每个VM配置两块网卡,第一块是NAT,第二块是host-only,其中,host-only需要在VB中设置一下。
b. 使用sudo apt-get install git 安装git
c. 首次上传project
(1)定位到project所在的文件夹,然后使用 git add . 创建local 仓库。
(2)使用命令git commit -m "description"
(3) git remote add origin "remote repository URL"
(4) git remote -v #测试一下URL
(5) git push origin master # 完成上传
d. 更新project
(1) git add.
(2) git commit -m "xxx"
(3) git push origin master
3. VM安装mysql
https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-18-04
具体而言:
sudo apt install mysql-server
1) 首先使用system status mysql.service 查看mysql服务是否启动;如未启动,使用sudo systemctl start mysql.
2) 使用navicat连接mysql