仮想マシン構築後、VNCクライアントから192.168.1.113:5901にアクセスします。パスワードはvagrantです。
Vagrantfile
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "bento/ubuntu-16.04"
config.vm.hostname = "ub1604vncxfceatom"
config.vm.network :public_network, ip:"192.168.1.113"
config.vm.provider :virtualbox do |vbox|
vbox.name = "ub1604vncxfceatom"
vbox.gui = true
vbox.cpus = 4
vbox.memory = 4096
end
config.vm.provision "shell", inline: <<-SHELL
sed -i.bak -e "s#http://us.archive.ubuntu.com/ubuntu/#http://ftp.riken.jp/pub/Linux/ubuntu/#g"; /etc/apt/sources.list
localectl set-locale LANG=ja_JP.UTF-8
localectl set-keymap jp106
apt-get update
apt-get -y install fcitx-mozc xubuntu-desktop language-pack-ja tightvncserver expect
im-config -n fcitx
# set passwd for vnc
cat << EOC > /tmp/initpass.sh
/usr/bin/expect << EOF
spawn "vncpasswd"
expect "Password:"
send "vagrant\\r"
expect "Verify:"
send "vagrant\\r"
expect "Would you like to enter a view-only password (y/n)?"
send "n\\r"
expect eof
exit
EOF
EOC
chmod +x /tmp/initpass.sh
sudo -u vagrant -H /bin/bash -c "/tmp/initpass.sh"
sudo -u vagrant -H /bin/bash -c "/usr/bin/vncserver"
echo 'startxfce4 &' >> /home/vagrant/.vnc/xstartup
chown vagrant:vagrant /home/vagrant/.vnc/xstartup
cat << EOF > /etc/systemd/system/vnc@.service
[Unit]
Description=tightvncserver
After=syslog.target network.target
[Service]
Type=forking
User=vagrant
PAMName=login
PIDFile=/home/vagrant/.vnc/%H:%i.pid
ExecStartPre=/usr/bin/vncserver -kill :%i > /dev/null 2>&1
ExecStart=/usr/bin/vncserver -geometry 1280x800 -depth 24 :%i
ExecStop=/usr/bin/vncserver -kill :%i
[Install]
WantedBy=multi-user.target
EOF
systemctl enable vnc@1.service
systemctl dbus start
cat << EOC > /tmp/startvnc.sh
/usr/bin/expect << EOF
spawn systemctl start vnc@1.service
expect "Password:"
send "vagrant\\r"
expect eof
exit
EOF
EOC
chmod +x /tmp/startvnc.sh
sudo -u vagrant -H /bin/bash -c "/tmp/startvnc.sh"
# install atom
apt-get -y install gvfs-bin git
wget https://github.com/atom/atom/releases/download/v1.21.2/atom-amd64.deb
dpkg -i atom-amd64.deb
cp /usr/lib/x86_64-linux-gnu/libxcb.so.1 /usr/share/atom
sed -i 's/BIG-REQUESTS/_IG-REQUESTS/' /usr/share/atom/libxcb.so.1
SHELL
end
〇Atomの画面
0 件のコメント:
コメントを投稿