Windows 10下Linux子系统安装图形界面及浏览器并设置开启启动
1、安装图形界面
sudo apt-get update
sudo apt-get install xorg
sudo apt-get install xfce4
sudo apt-get install xrdp
sudo sed -i ‘s/port=3389/port=3390/g’ /etc/xrdp/xrdp.ini
sudo echo xfce4-session >~/.xsession
sudo service xrdp restart
2、安装chrome浏览器
sudo wget http://www.linuxidc.com/files/repo/google-chrome.list -P /etc/apt/sources.list.d/
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo apt-get update
sudo apt-get install google-chrome-stable
google-chrome-stable
3、配置自启动脚本rc.local
3.1、编辑/etc/rc.local
$sudo vi /etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
sudo service xrdp start
exit 0
3.2、设置此脚本为自动启动
sudo chown root:root /etc/rc.local
sudo chmod +x /etc/rc.local
sudo service rc.local.service on
sudo service rc.local.service start
sudo service rc.local.service status
4、利用systemctl命令编写自定义服务实现开机自启
4.1、新建mytest.service
$sudo vi /home/yourname/mytest.service
[Unit]
Description=My Test
After=syslog.target
[Service]
ExecStart=/home/yourname/mytest.sh
SuccessExitStatus=0
[Install]
WantedBy=multi-user.target
4.2、新建mytest.sh
$sudo vi /home/yourname/mytest.sh
#!/bin/bash
cd
touch mytest.out
echo 'hello world!' >> test.out
4.3、设置自启动
service /home/yourname/mytest.service on
service mytest.service start
service mytest.service stop
service mytest.service status
移除开机自启:service mytest.service off