Windows 10下Linux子系统安装图形界面及浏览器并设置开启启动

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

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值