Wsl installs ubuntu and sets up gnome graphical interface detailed steps (win11+ubuntu18)

Whether the old friend is safe or not,
the spring and autumn will be snapped,
and no one will stay
– "Sudden Meng Youth Stories"

0. Preface

Wsl is indeed a good thing, but it has been configured several times before without success, because wsl itself does have bugs. At that time, I found an issue on GitHub that had not been fixed. Now configure it again.
My environment is Windows 11 Home Edition. Different from win10, win11 defaults to wsl2 after installation.

1. Download

First open the windows app store. Just search for "store" in the search bar. Search for ubuntu18 and click Install.
At this time, I knew that someone was going to say, ah, I opened the app store and reported an error or something, and I couldn’t connect to the server like that before. Check it yourself, it's a good solution.
shop

2. Initialization

After the download is complete, click Open, and you will be asked to enter your username, password, and confirm password. Entering the password will not be displayed, just enter it and press Enter.
initialization 1

3. Change source

Because the graphical interface has not been configured yet, it cannot be used gedit, and the source must be edited with vim. I never back up the original files, and I'm not going to change them back anyway.

sudo vim /etc/apt/source.list

Keep pressing after entering d, dit is the shortcut key to delete a line in vim. After deleting it, press ito enter edit mode.
Copy the source below and right-click to paste.

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse

After pasting, Escpress the key to return to the command mode, enter :wq, press Enter to save and exit, the screenshot is as follows.
edited
Update software source list

sudo apt-get update

3. Graphical interface configuration

Let's install gnome. I don't like xfce4, although it is indeed small and convenient, but I just don't get used to it. It is obviously a full version of the Ubuntu distribution, but after installing xfce4, it looks like a small Raspberry Pi, how decent it is!
In addition, I personally feel that the gnome in Ubuntu 18 and later releases is indeed better than before. On the contrary, the UI of win11 is really a bit stretched. The system UI is okay, and the mica color design is very harmonious and attractive. But in actual use, the styles of various applications are not uniform, and they cannot reach the level of harmony at all. It is not as good-looking as frosted glass.

WSL does not support systemd and Gnome desktop is based on systemd, so solve this problem first.

sudo apt update
sudo apt install git
git clone https://github.com/DamionGans/ubuntu-wsl2-systemd-script.git
cd ubuntu-wsl2-systemd-script/
bash ubuntu-wsl2-systemd-script.sh

After the script is executed, there will be a special sentence indicating that the execution was successful. Don't worry about what is played in the middle.
After installing systemd, return to the windows terminal (fork this terminal directly), and be sure to enter

wsl --shutdown

Completely shut down the ubuntu where wsl is running, otherwise it is not completely shut down.
First confirm that your wsl version is wsl2. win11 should default to wsl2, if not, the upgrade method is as follows:

wsl -l -v

Check the version, it should be like this
Version

If your later version is 1, then you need to upgrade, please use

wsl --set-version <distro name> 2 

command will <distro name>be replaced with the name of the Linux distribution to update. For example,

wsl --set-version Ubuntu-20.04 2 

will set up the Ubuntu 20.04 distribution to use WSL 2.
Then type in the windows terminal

wsl

Restart the ubuntu terminal. enter

systemctl

Confirm that systemctl can be used, just come out with a bunch of things, if it fails, it will be

System has not been booted with systemd as init system (PID 1). Can't operate.

When it is confirmed that it is correct, install the gnome desktop

sudo apt update
sudo apt install -y ubuntu-desktop

The installation content is nearly 2GB, but it will take a long time to install if your network is slightly inferior. The data of my mobile phone has been installed for an hour. It was downloaded very quickly at the beginning, and then it became more than 100 kb for some reason. . .

Then install Xrdp

sudo apt install -y xrdp
sudo adduser xrdp ssl-cert
sudo systemctl restart xrdp

Check the port in the configuration file (default: 3389)

vim /etc/xrdp/xrdp.ini

configure firewall

sudo ufw allow 3389

Remote desktop link
remote linkLog in
Type in the user name and password, after ok
to enter, two authentication boxes may pop up, just cancel and cancel, don't worry about it.
There will also be an authentication when shutting down.
shutdown authentication
Enter the password, and click the one on the right to shut down.

4. Subsequent startup

windows terminal:

wsl

But one problem that I personally didn't solve is that every restart requires re-entering

sudo systemctl restart xrdp

Then start the remote link.
I don't know if there is any better way to save such a command.

Thank you for all the flowers in Luoyang, love is
always only a moment, and we
meet again .

Guess you like

Origin blog.csdn.net/m0_51194302/article/details/127891929