Best Practice to Keep the Ubuntu Environment Clean
Package installation
There are normally two ways to install packages, one is apt get, another is pip install. The first difference between them is that the packages installed by apt get are the system-level packages requiring root privilege, and for pip install, you can specify the user by –user to keep from messing up the system environment (ALWAY DO NOT USE sudo pip install). The second difference which can be more important is that when executing sudo apt update && apt upgrade
, the packages installed by apt would be upgraded, while the packages installed by pip wouldn’t. So in my view, the best practice to install packages:
- Try apt search and install by apt first.
- Download virtualenv to manage the Python environment and manage packages.
- Install the package by pip inside the virtual env.
System Setting Up
Ok, so I had a hard time fixing my wifi and Bluetooth on my new mini PC. Since the CPU of my PC is n100, just too new to be compatible with the wifi and Bluetooth.
WIFI Fixing Process
Firstly, I downloaded Ubuntu 22.04.3 LTS and noticed that on the desktop, there was totally no wifi label, after searching, I found that I could simply upgrade my kernel to 6.4 to fix this problem (Since I had not wifi, so I had to go this site: https://kernel.ubuntu.com/mainline/v6.4/amd64 and manually downloaded the four deb files and installed them by apt command). However, I could see the wifi label and connect to my phone hotspot network, but I could not get access to my college network. Thankfully, this post gave a solution: https://askubuntu.com/questions/286915/cant-connect-to-specific-wifi-network?rq=1.
sudo ifconfig eth0 down
sudo modprobe -r iwlwifi
sudo modprobe iwlwifi 11n_disable=1
The eth0 should be replaced by your wireless device ID. So the above command simply modifies the mod parameter 11n_disable to 1, disabling the 802.11n support for the iwlwifi module. And I made it a script, since every time you reboot your system, you need to run the commands again.
Bluetooth Fixing Process
I simply followed the method offered in this post: https://github.com/batocera-linux/batocera.linux/issues/9288 and enabled my Bluetooth successfully.
cd /lib/firmware/intel/
ln -s ibt-1040-4150.ddc ibt-0040-1050.ddc
ln -s ibt-1040-4150.sfi ibt-0040-1050.sfi
lsmod | grep '^bluetooth'
bluetooth 1101824 37 btrtl,...
rmmod ...
modprobe ...
Cloudflare Tunnel SSH Setting
Since I already have a domain name, instead of using a tool such as FRP, I finally chose to use Cloudflare Tunnel which is free and easy to implement (https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/). By the way, I quickly set up my ufw and ssh service to only allow the OpenSSH application and accept only ssh key login.
Comment