阿里云服务器ECS Ubuntu16.04-64-bit学习之一:配置桌面(进阶-脚本一键执行)

前面写的教程需要一步步去查看执行的结果,看到很多回复的朋友说碰到很多问题,这次教程是通过Shell脚本直接一次到位,不需要那么多繁琐的操作
工具putty(登录后台运行脚本)、WinScp(上传文件)
脚本文件

文件名:oneKeyInstall.sh
#!/bin/bash
apt-get update
apt-get upgrade
apt-get install ubuntu-desktop
ping 127.0.0.1 -c 5
mv 50-ubuntu.conf /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf
mv 1.profile /root/.profile
ping 127.0.0.1 -c 5
reboot
配置文件-1:1.profile
# ~/.profile: executed by Bourne-compatible login shells.

if [ "$BASH" ]; then
  if [ -f ~/.bashrc ]; then
    . ~/.bashrc
  fi
fi
tty -s && mesg n || true
配置文件-250-ubuntu.conf
[Seat:*]
user-session=ubuntu
greeter-show-manual-login=true
allow-guest=false

注意:如果是将这些代码直接写到文件(在win7),一定要保存为unix-ANSI格式,否则win7默认是gbk,复制到linux系统会执行可能会由于编码问题而失败(可以直接下载我的资源文件
这里写图片描述
操作步骤:
1、通过WinSCP文件传输工具将这三个文件放在服务器的同一个文件夹下
这里写图片描述

2、putty登录后台执行脚本
bash oneKeyInstall.sh
这里写图片描述
3、执行结束后在阿里云终端登录(可以用root登录)
这里写图片描述
这里写图片描述

是不是很简单呢?小伙伴快去试试吧

猜你喜欢

转载自blog.csdn.net/qq_37608398/article/details/80358874