[Ubuntu Server 22.04] 在Ubuntu桌面安装上,进行自动登录的设定

注意事项

请在链接中进行记录

[Ubuntu Server 22.04] 个人初期设置备忘录

总而言之

“Contents” -> 目录

1. 安装Tailscale
2. 安装WeTTY
3. 安装Ubuntu桌面(GDM3自定义Ubuntu)并进行自动登录设置
概述
构建
– 安装和配置
安装Ubuntu桌面环境GNOME
配置GUI的自动登录
启动GNOME
– 自动登录到Ubuntu服务器本身
引用来源、参考来源、参考资料
4. 设置Ubuntu桌面RDP
5. 安装PowerTOP TLP
6. 自动重启设置(Crontab, rtcwake)

“说明”

Ubuntu Desktop 是基于GNOME Desktop的Ubuntu定制版本。

建筑

安装和设置

安装Ubuntu使用的GNOME桌面环境。
    1. GNOME 安装

 

    1. sudo apt update && sudo apt upgrade -y

 

    1. sudo apt install ubuntu-desktop -y

在电脑启动时,显示CUI界面(将默认目标切换为CUI)
sudo systemctl set-default multi-user.target

进行一次重新启动
sudo reboot
或者
sudo shutdown -r now

[自动登录设置适用于图形用户界面(GUI)]
’/etc/gdm3/custom.conf 在[daemon]下填写以下内容
’|[daemon]
’|# Uncomment the line below to force the login screen to use Xorg
’|#WaylandEnable=false
’|
’|# Enabling automatic login
’|AutomaticLoginEnable = True
’|AutomaticLogin = 这里是用户名

例)
sudo vim /etc/gdm3/custom.conf
#按 i,输入下面的数字。
[daemon]
AutomaticLoginEnable=True
AutomaticLogin=USER_1
# 按Esc 
# :先按x 再按Enter
cat /etc/gdm3/custom.conf
启动 GNOME
sudo systemctl start gdm3
sudo systemctl status gdm3

Ubuntu Server自动登录到自身。

只需一种选择的方式,将以下表述用中国语言进行本地化:
如果您希望自动登录到TTY1,虽然这并不推荐,但请执行以下步骤。

sudo mkdir '/etc/systemd/system/getty@tty1.service.d'

# drop-in 创建文件
sudo su -c "cat << '__EOF__' > '/etc/systemd/system/getty@tty1.service.d/autologin.conf'
### Editing /etc/systemd/system/getty@tty1.service.d/override.conf
### Anything between here and the comment below will become the new contents of the file

[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin $(whoami) --noclear %I 38400 linux
__EOF__"

# 检查是否已创建。
sudo ls -laF /etc/systemd/system/getty@tty1.service.d/
# 必要时更改换行代码
sudo sed -i -e 's/\r//g' "/etc/systemd/system/getty@tty1.service.d/autologin.conf"
#检查条目,特别是用户名。
sudo cat /etc/systemd/system/getty@tty1.service.d/autologin.conf

# 反映您输入的信息。
sudo systemctl daemon-reload
# 检查是否正确添加。
sudo systemctl --no-pager cat getty@tty1.service

引用来源、参照来源、参考来源

在Ubuntu Server22.04上安装GUI(桌面)环境的方法:
– https://4thsight.xyz/40719

如何启用Ubuntu 20.04上的自动登录?-Linux提示:
– https://ciksiti.com/ja/chapters/608-how-to-enable-automatic-login-on-ubuntu-20-04—linux-hint

自动登录tty1设置当启动电源:
– /etc/systemd/system/getty@tty1.service.d/autologin.conf

ArchWiki:虚拟控制台:
– https://wiki.archlinux.org/title/Getty#Automatic_login_to_virtual_consol

使用systemd实现自动登录(非GUI)(适用于Ubuntu 16.04+和Debian 8+):
– https://www.blackmanticore.com/8683a884ca8aad72b46442e0b7196cef

bannerAds