vm 安装ubuntu server 18.04 周边配置
系统安装
与宿主机共享文件夹
要安装vmware-tools
sudo apt update
sudo apt install open-vm-tools open-vm-tools-desktop -y
进入终端界面,执行一下命令:
vmware-hgfsclient
如果看到cpp,说明可以挂载
执行命令:
sudo mkdir -p /mnt/hgfs
创建共享文件夹专用的挂载目录
执行以下命令挂载共享文件夹:
sudo /usr/bin/vmhgfs-fuse .host:/ /mnt/hgfs -o subtype=vmhgfs-fuse,allow_other
至此即可访问主机上的共享文件夹,继续执行:
ls -l /mnt/hgfs
就可以看到共享文件夹cpp了。
上述设置重启系统时会丢失,如果要在开机时自动挂载共享文件夹,则需要更改/etc/fstab文件夹,在末尾加:
.host:/ /mnt/hgfs fuse.vmhgfs-fuse allow_other,defaults 0 0
手机UBS共享网络
ip a show
ip link set ens35u1 up
dhclient ens35u1
ping www.baidu.com
安装 Docker
法一:
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun法二:也可以使用国内 daocloud 一键安装命令:
curl -sSL https://get.daocloud.io/docker | sh设置程序自动启动
#!/bin/sh ### BEGIN INIT INFO # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 ### END INIT INFO cd /home/ubuntu/frp_0.48.0_linux_amd64 nohup ./frpc -c ./frpc.ini &相关参考命令 cd /etc/init.d sudo vim code-server ... sudo systemctl enable code-server sudo systemctl start code-server sudo systemctl daemon-reload sudo systemctl disable code-server安装code-server加默认启动
manual script curl -fOL https://github.com/coder/code-server/releases/download/v$VERSION/code-server_${VERSION}_amd64.deb sudo dpkg -i code-server_${VERSION}_amd64.deb sudo systemctl enable --now code-server@$USER eg. curl -fOL https://github.com/coder/code-server/releases/download/v4.11.0/code-server_4.11.0_amd64.deb auto script curl -fsSL https://code-server.dev/install.sh | sh Ubuntu 22.04.3 LTS Installing v4.20.0 of the amd64 deb package from GitHub. + mkdir -p ~/.cache/code-server + curl -#fL -o ~/.cache/code-server/code-server_4.20.0_amd64.deb.incomplete -C - https://github.com/coder/code-server/releases/download/v4.20.0/code-server_4.20.0_amd64.deb ######################################################################## 100.0% + mv ~/.cache/code-server/code-server_4.20.0_amd64.deb.incomplete ~/.cache/code-server/code-server_4.20.0_amd64.deb + sudo dpkg -i ~/.cache/code-server/code-server_4.20.0_amd64.deb [sudo] password for ubuntu: Selecting previously unselected package code-server. (Reading database ... 226252 files and directories currently installed.) Preparing to unpack .../code-server_4.20.0_amd64.deb ... Unpacking code-server (4.20.0) ... Setting up code-server (4.20.0) ... deb package has been installed. To have systemd start code-server now and restart on boot: sudo systemctl enable --now code-server@$USER Or, if you don't want/need a background service you can run: code-server Deploy code-server for your team with Coder: https://github.com/coder/coderfrp auto startup
/lib/systemd/system$ sudo vim frp-server@.service [Unit] Description=code-server After=network.target [Service] Type=exec WorkingDirectory=/home/ubuntu/frp_0.46.1/ ExecStart=nohup ./frpc -c ./frpc.ini Restart=always User=%i [Install] WantedBy=default.target sudo systemctl enable --now frp-server@$USER/lib/systemd/system$ systemctl status frp-server@ubuntu.service ● frp-server@ubuntu.service - code-server Loaded: loaded (/lib/systemd/system/frp-server@.service; enabled; vendor preset: enabled) Active: active (running) since Wed 2024-01-17 22:24:24 CST; 8h left Main PID: 1406 (frpc) Tasks: 12 (limit: 77167) Memory: 6.1M CPU: 59ms CGroup: /system.slice/system-frp\x2dserver.slice/frp-server@ubuntu.service └─1406 ./frpc -c ./frpc.ini 1月 17 22:24:24 ubuntu2204-4389 systemd[1]: Starting code-server... 1月 17 22:24:24 ubuntu2204-4389 systemd[1]: Started code-server. ubuntu@ubuntu2204-4389:/lib/systemd/system$