Archives For November 30, 1999

For Ubuntu 24.04 and other Linux with GNOME 43 ~ 46, it’s now easy to add Media Control, Notifications, or Volume Mixer to the top-right corner system status menu (aka Quick Settings), or remove useless buttons.

It’s ‘Quick Settings Tweaker‘, an extension for the new GNOME desktop. With it, your system menu can be configured to look like:


Continue Reading…

NVIDIA 520, the latest feature release of NVIDIA driver for Linux, is available to install in all current Ubuntu LTS releases.

So far, it’s NVIDIA 520.56.06 released few weeks ago with following new features:

  • Implement over-the-air (OTA )updates in the Proton and Wine NVIDIA NGX build, though needs to set “PROTON_ENABLE_NGX_UPDATER” to 1 to enable it.
  • Following extensions no longer depend on nvidia-uvm.ko at runtime:
    • VK_KHR_acceleration_structure
    • VK_KHR_deferred_host_operations
    • VK_KHR_ray_query
    • VK_KHR_ray_tracing_pipeline
    • VK_NV_cuda_kernel_launch
    • VK_NV_ray_tracing
    • VK_NV_ray_tracing_motion_blur
    • VK_NVX_binary_import
    • VK_NVX_image_view_handle
  • Fixed blank screens and hangs when starting an X server on RTX 30 series GPUs boot with HDMI.
  • Fixed a bug where Marvel’s Spider-Man Remastered would sometimes crash with Xid 13 errors on Turing and later

How to Install NVIDIA 520 in Ubuntu

NOTE: Though it’s tested and works good in my case, it might still breaks your system (usually boot into blank screen) due to various reasons (e.g., upstream bug or corrupt installation)! So don’t do it in production machine!

The driver package is available now for Ubuntu 18.04, Ubuntu 20.04, and Ubuntu 22.04. For Ubuntu 22.10 user, it’s so far in pre-released repository, though should be published soon in next few days.

1. First, it’s HIGHLY recommended to update system by launching ‘Software Updater‘ and install all available updates! And, restart your system if it asks.

2. Second, search for and open ‘Additional Drivers‘ from Activities overview screen.

3. When it opens, choose “nvidia-driver-520” from the list, and click ‘Apply Changes’ button to install the driver.

In case you don’t see the 520 driver in the list, navigate to the first ‘Ubuntu Software’ tab, and make sure the 4 repositories (main, universe, restricted, multiverse) are enabled. Finally, close and Reload, and re-open the utility.

After installation, the ‘Additional Drivers‘ utility should prompt to restart your computer to apply change.

Verify

After restarting computer, open ‘Settings‘ and navigate to ‘About‘ page to verify if your NVIDIA graphics card is in use.

And, search for and open ‘NVIDIA Settings‘ utility to for driver version, GPU switching, and other settings.

Due to bug, you can’t switch to Intel (Power Saving Mode) with the tool, you can however install an extension to do the job via system status menu option.

Install ‘Prime indicator’ for switching GPU

For Ubuntu 22.04, search for and install ‘Extension Manager‘ from Ubuntu Software app. Then, use the tool to search and install ‘Prime Inidcator’.

For Ubuntu 20.04 and Ubuntu 18.04, first open terminal (Ctrl+Alt+T) and run command to install the agent package:

sudo apt install chrome-gnome-shell

Then visit the extension web page and use the ON/OFF switch to install it:

In case you don’t see the ON/OFF switch, follow the link in that page to install browser extension and refresh.

After installing the extension, go to top-right system status menu to switch between Intel, NVIDIA, and hybrid mode.

IMPORTANT: The Extension will automatically log out once your select another GPU mode and confirm with password!!! Save your works before doing change.

The popular Python programming language released version 3.11 today. Here’s the new features and how to install guide for all current Ubuntu releases.

Python 3.11 claimed to be 10-60% faster than the previous 3.10, and features:

  • Exception Groups and except* to raise and handle multiple unrelated exceptions simultaneously.
  • Add add_note() method to BaseException to enrich exceptions.
  • Add the tomllib module to the standard library for parsing TOML
  • Point to exact expression that caused error when printing tracebacks.
  • New -P command line option and PYTHONSAFEPATH environment variable
  • Add TypeVarTuple, enabling parameterisation with an arbitrary number of types
  • Required[] and NotRequired[] to mark whether individual TypedDict items must be present.
  • Add Self to annotate methods that return an instance of their class
  • LiteralString to accept arbitrary literal string types, such as Literal["foo"] or Literal["bar"].
  • dataclass_transform to decorate a class, metaclass, or a function that is itself a decorator.
  • Removed Py_UNICODE encoder APIs
  • Macros converted to static inline functions
  • Many legacy standard library modules deprecated and to be removed in Python 3.13

How to Install Python 3.11 in Ubuntu

For Ubuntu 22.04, Ubuntu 20.04, Ubuntu 18.04, and their derivatives, such as Linux Mint, there’s a popular Deadsnakes PPA maintains the packages for Python 3.11 as well as other Python versions.

NOTE: The PPA does not support Ubuntu 22.10. You may follow the bottom link to build it from source tarball.

1. First, press Ctrl+Alt+T on keyboard to open terminal. When it opens, run command to add the PPA:

sudo add-apt-repository ppa:deadsnakes/ppa

Type user password when it asks (no asterisk feedback) and hit Enter to continue

2. Then refresh package cache via command below, though it’s done automatically in Ubuntu 20.04+:

sudo apt update

3. Finally, install python 3.11 via command:

sudo apt install python3.11

Or replace python3.11 with python3.11-full for IDE, pip package manager, etc.

Verify:

To verify, run python3.11 --version, python3.11 -m pip --version in terminal.

Set Python 3.11 as default

NOTE: change default Python3 in Ubuntu may cause issues for some default apps, such as GNOME Terminal

You may set the new Python package as default by using update-alternatives command line tool.

1. First, run command to create symbolic links for system default python (change python3.10 depends your Ubuntu edition)

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 110

2. Then, add the new Python 3.11 via command:

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 100

3. After that, you may choose which Python as Python3 at any time by running command:

sudo update-alternatives --config python3

Compile and install Python 3.11 manually from source

User may also compile the programming language from source tarball manually.

First, download the source from Python web site, then you may follow this step by step guide that I’ve tested in my Ubuntu 22.10 machine.

The popular KeePassXC password manager got its 3rd update for the 2.7 release series with new features and various bug-fixes.

The new release now has a graphical way to export XML via menu ‘Database -> Export -> XML file‘, via the same logic as the corresponding CLI export option.

When searching in KeePassXC 2.7.3, a little save icon will appear in the right end of the search-box, allowing to save searches and access easily from the bottom-left panel.

The release also enhanced tabs support, improved the entry preview panel, and added CLI changes including:

  • db-edit command to change/remove key file or password.
  • Add option to display all attributes with show command
  • Show UUID and tags with show and clip commands

Other changes in KeePassXC 2.7.3 include:

  • Indicate password strength to all password fields
  • Limit password length to 128 characters.
  • Add shortcut to copy password with TOTP appended
  • Ctrl+Tab shortcut to cycle databases in unlock dialog
  • Allow built without X11.
  • Config variable to specify default database name.
  • Fix dark mode detection in Linux.

How to Install KeePassXC 2.7.3 in Ubuntu Linux

Ubuntu user can directly search for and install the latest version of KeePassXC from Ubuntu Software app, though it’s Snap package run in sandbox.

KeePassXC Snap package in Ubuntu Software

For those prefer the native .deb package format, it has an official PPA contains the latest packages for Ubuntu 18.04, Ubuntu 20.04, Ubuntu 22.04, and Ubuntu 22.10.

1. First, press Ctrl+Alt+T on keyboard to open terminal and run command to add the PPA:

sudo add-apt-repository ppa:phoerious/keepassxc

Type user password when it asks (no asterisk feedback) and hit Enter to continue.

2. If you have an old version of KeePassXC installed as .deb package, simply launch “Software Updater” or Update Manager to update it to the latest.

Or, run the apt command below in terminal to install the password manager:

sudo apt install keepassxc

NOTE: Linux Mint has to run sudo apt update first to update cache.

After installation, search for and open the tool either from ‘Activities’ overview or system start menu depends on your desktop environment.

Uninstall KeePassXC

To uninstall the password manager installed as native .deb package, either use Ubuntu Software app or open terminal and run command:

sudo apt remove --autoremove keepassxc

And remove the PPA repository either via ‘Software & Updates‘ tool under ‘Other Software‘ tab, or command below in terminal:

sudo add-apt-repository --remove ppa:phoerious/keepassxc

That’s all. Enjoy!

Ubuntu shows your computer manufacturer logo in the startup animation screen since 20.04 LTS. User can however disable it and/or replace it with system logo. And, this simple tutorial will show you how.

Most Linux’s boot animation screen is handled by Plymouth with specific theme. By editing the theme configuration file can do the trick to disable the Original Equipment Manufacturer (OEM) logo, and changing the background image to use system logo instead.

Boot animation screen after this tutorial

Step 1: Disable manufacturer logo

Ubuntu uses “/usr/share/plymouth/themes/bgrt/bgrt.plymouth” as default Plymouth theme, it has an option in configuration file to disable the vendor logo.

Method 1: Switch to spinner theme

The default bgrt theme is just a wrapper to the spinner theme with different font, and OEM logo settings.

You can simply to switch to the spinner theme, so it will no longer display manufacturer logo while most other things look same.

For more other Linux, such as Fedora Workstation, this can be done by running a single command in terminal:

sudo plymouth-set-default-theme spinner

But for Ubuntu, you have to do following steps one by one:

1. Firstly, press Ctrl+Alt+T on keyboard to open terminal. When terminal opens, run command to install spinner theme as an alternative:

sudo update-alternatives --install /usr/share/plymouth/themes/default.plymouth default.plymouth /usr/share/plymouth/themes/spinner/spinner.plymouth 100

2. After that, run command to configure the default plymouth theme:

sudo update-alternatives --config default.plymouth

In terminal screen, type the number for the spinner theme and hit Enter.

Method 2: Edit the config file for bgrt theme

Without switching theme, you may also edit the configuration file  for the default ‘bgrt’ theme, and disable the OEM logo.

Tip: For XUbuntu, KUbuntu, and other Debian/Ubuntu based system, use this command sudo update-alternatives --display default.plymouth to find out the default theme.

1. First, press Ctrl+Alt+T on keyboard to open a terminal window. When it opens, run command to edit the file:

sudo gedit /usr/share/plymouth/themes/bgrt/bgrt.plymouth

For Ubuntu 24.04 and higher, replace gedit in command with gnome-text-editor, or use nano text editor for other desktop environment.

2. When the file opens, find out and set value of ‘UseFirmwareBackground’ to false under boot-up, reboot, and shutdown sections.

After saving the change (for nano, press Ctrl+X, type y and hit Enter), the boot animation screen will look like:

Step 2: Set Ubuntu System Logo (optional)

As you see in the screenshot above, there will be a large area of blank screen in top-half, after disabling OEM logo.

For choice, you can place Ubuntu logo in screen center, so your boot/shutdown animation screen will look like the top image shows you. To do the job, you just need to put a ‘background-tile.png‘ image file in the spinner theme folder.

1. First, press Ctrl+Alt+T on keyboard to open terminal. When terminal opens, run command to install imagemagick:

sudo apt install imagemagick

2. The theme folder includes a “bgrt-fallback.png” file, which is Ubuntu logo with transparent background.

Run the commands below, will use imagemagick tool to generate the “background-tile.png” file with 1920×1080 size. And, put the Ubuntu logo in center with transparent background.

cd /usr/share/plymouth/themes/spinner
sudo convert bgrt-fallback.png -gravity center -background none -extent 1920x1080 background-tile.png

In command, replace 1920×1080 with your screen resolution! You can find it in “Displays” setting page.

If this command is done correctly, your boot animation should display Ubuntu logo in screen center. Though, you can of course put any image into ‘/usr/share/plymouth/themes/spinner‘ directory, name to ‘background-tile.png’ to display as background.

Step 3: Verify

Without restart your computer, you can preview boot animation screen by running single command in terminal:

sudo plymouthd; sudo plymouth --show-splash; sleep 5; sudo plymouth --quit

It shows you full-screen boot animation, and quit in 5 seconds.

Ubuntu 22.10 Kinetic Kudu is out! Time to install the new system and do same configurations before ready for use. And, here are a list of things I can tell for you.

1. Update cache & install Media Codec

On a new Ubuntu system, user may need to refresh package index before being able to install software packages. And, this can be done easily by:

  • Launch ‘Software Updater’, and wait for automatically ‘checking for updates’ done.
  • Or, press Ctrl+Alt+T on keyboard to open terminal, and run command:
    sudo apt update

    type user password when it asks while no asterisk feedback.

Ubuntu does not include multimedia codec to play video and/or music with default applications out-of-the-box. It’s however quite easy to install them

  • Either open ‘Ubuntu Software’, search for and install ‘Ubuntu restricted extra’
  • Or, open terminal (Ctrl+Alt+T) and run command:
    sudo apt install ubuntu-restricted-extras

    While installing the MS fonts, it will prompt to accept licence, just press Tab to highlight OK and hit Enter.

For KUbuntu user, replace ubuntu-restricted-extras with kubuntu-restricted-extras in command.

2. Enable Flatpak & AppImage support

Ubuntu officially supports Snap and Deb package formats. But, we can avoid the popular Flatpak and AppImage software packages today in Linux.

AppImage requires libfuse2 which is NOT pre-installed since Ubuntu 22.04, due to switch to fuse3. The package is however still available in system repository.

  • Open terminal (Ctrl+Alt+T) and run command to enable AppImage support:
    sudo apt install libfuse2

Ubuntu also does not support Flatpak out-of-the-box, but it can be enabled by running a single command:

  • Enable Flatpak in Ubuntu:
    sudo apt install flatpak

After that, you may go to flathub.org to find out and install your favorite apps as Flatpak.

3. Hide USB/Mounted Disk from left Panel, Enalbe Minimize on click

The left (or bottom) panel shows the connected USB stick, mounted disk volume out-of-the-box. User can however hide them using the new ‘Ubuntu Dock’ settings.

  • First, go to top-right corner system tray menu, and click on ‘gear’ button to open settings.
  • When ‘Settings’ opens, navigate to the new ‘Ubuntu Dock‘ tab. Then, click on “Configure dock behavior” in button right
  • Finally, you may use the ON/OFF switch to show/hide the mounted drivers as well as trash can icon.

To enable the behavior that click the app icon on left (or bottom) dock panel to focus or minimize app window, open terminal (Ctrl+Alt+T) and run command:

gsettings set org.gnome.shell.extensions.dash-to-dock click-action 'minimize'

Ubuntu 22.10 introduced a new feature that when clicking app icon on dock, it goes to overview screen for easy switching this app if multiple windows opened. So, use the command below instead can be a better choice:

gsettings set org.gnome.shell.extensions.dash-to-dock click-action 'focus-minimize-or-appspread'

After that, clicking app icon on dock panel will either open/focus window, minimize or goes overview for switching window.

4. Enable ‘New Documents’ context menu

GNOME is now working to make it easy to create new documents in ‘Files’ (aka Nautilus file manager). Until then, user need to manually create an empty document in ‘Templates’ folder to enable this context menu option.

  1. First, click top-left ‘Activities’ to open overview screen. Then search for and open ‘Text Editor’.
  2. In text editor window, go to ‘≡’ menu and select ‘save as’ option (You don’t have to insert anything, just save as empty document).
  3. Finally, save the empty file as ‘Empty Document‘ into your ‘Templates‘ folder.

After that, right-click on blank area either in desktop or file manager window to see the ‘New Document’ option.

5. Install useful configuration tool

There are some useful configuration tools that you may need. Either install them via “Ubuntu Software” app or run the apt commands below in terminal.

  • Open terminal (Ctrl+Alt+T) and run command to install Gnome Tweaks:
    sudo apt install gnome-tweaks

GNOME Tweaks

  • Run command to install ‘Extension Manager’ for install & managing extensions:
    sudo apt install gnome-shell-extension-manager

Extension Manager

Install some cool Gnome Shell Extensions, (e.g. ‘Just Perfect’, ‘Blur my shell’), via extension manager app under ‘Browse’ tab.

Just Perfection with even more configuration options

6. Set light/dark photo images as wallpaper that switch automatically

GNOME 40 introduced adaptive wallpaper that changes automatically depends on system color scheme. It’s not available in Ubuntu 22.04 due to custom ‘Settings’ dialog. For Ubuntu 22.10, you can set your photo images with light and dark versions to wallpaper via following steps.

  1. First, open ‘Files‘ (nautilus file manager), then press Ctrl+H to show hidden files/folders.
  2. Then, navigate to .local/share and create a new sub-folder called ‘gnome-background-properties
  3. Finally, create a .xml file under that folder with whatever name, and insert following content (change path-to-file accordingly).
<?xml version="1.0"?>
<!DOCTYPE wallpapers SYSTEM "gnome-wp-list.dtd">
<wallpapers>
  <wallpaper deleted="false">
    <name>TYPE_NAME_HERE</name>
    <filename>/PATH/TO/PICTURE_LIGHT</filename>
    <filename-dark>/PATH/TO/PICTURE_DARK</filename-dark>
    <options>zoom</options>
    <shade_type>solid</shade_type>
    <pcolor>#3465a4</pcolor>
    <scolor>#000000</scolor>
  </wallpaper>
</wallpapers>

After that, open ‘Settings’ and navigate to ‘Appearance’ for the new adaptive wallpaper:

7. Get ‘Login Manager Settings’ to configure login screen

GDM Settings is a login screen managing tool for GNOME display manager. The application now is stable for daily use though it’s young project.

  1. First, go to project page below and select download the AppImage
  2. Right-click on the AppImage, go to ‘Properties‘, and then turn on the option for ‘Executable as Program
  3. Finally, right-click and click ‘Run’ to launch the configuration tool.
  4. There go to ‘Appearance’ -> Background -> Type ‘Image’ and select a photo image for login screen.
  5. Configure font, color, logo, disable user list,etc as you want and finally click ‘Apply’ button to make changes.

Configure Login Screen Appearance

8. Install Firefox as classic Deb package

For those prefer the classic Deb to Snap, open terminal (Ctrl+Alt+T) and run the commands below one by one to switch Firefox from Snap to DEB.

  • Backup your important data if any.
  • Remove commands below one by one to remove Firefox:
    sudo apt remove --autoremove firefox
    sudo snap remove firefox
  • Add Mozillateam PPA:
    sudo add-apt-repository ppa:mozillateam/ppa
  • Finally, install Firefox as deb form PPA:
    sudo apt install -t 'o=LP-PPA-mozillateam' firefox

To prevent Ubuntu from automatically updating Firefox to Snap again, you also need to set a higher PPA priority. See this tutorial for details.

9. Switch back to Xorg session

If you have some old applications that are still NOT running properly in the default Wayland session. Simply log out, click username and use the bottom right ‘gear’ button menu to switch back Xorg session, and finally login.

This simple tutorial shows how to change the computer name (aka hostname) in your Ubuntu (Ubuntu 24.04 Noble Numbat updated) without a system restart.

The methods here are universal ways that works in not only default Ubuntu release but also its flavors (e.g., KUbuntu, XUbuntu), and even other Linux.

NOTE: A hostname can be a single word or phrase, including letters, number, periods, or hyphen with 253 characters length limit, with NO space.

Change Computer Name for Temporary Use

If possible to change the name for temporary use. So, the new name will work until you restart the system.

  • To do so, simply open terminal or connect to command console and run command:
    sudo hostname NEW_NAME_HERE

Replace ‘NEW_NAME_HERE’ and type user password (no asterisk feedback) to authenticate. And, you may need to restart terminal or console to see effect.

Change Computer Name by Editing Config file

The classic way to permanently change your system hostname is just edit the configuration file!

So, here I’m going to use the universal nano command line text editor to open the configuration file.

  • To do so, open terminal and run command:
    sudo nano /etc/hostname

When file opens in terminal, delete the old name and type a new one. Finally, press Ctrl+X, type y and hit Enter to save change.

This method however need a system restart if you’re running with default Wayland session. If you switched back Xorg session, run the command below to make it work without restart.

sudo systemctl restart systemd-logind.service

Use ‘hostnamectl’ to change computer name

The hostnamectl command is a good choice today to permanently change your computer name without system start.

  • As easy as the first method, just run command in command/console:
    hostnamectl hostname NEW_NAME_HERE

The change takes effect immediately, though you may need to restart terminal window.

Use new name in ‘/etc/hosts’

To avoid network issues, it’s HIGHLY recommend to also edit ‘/etc/hosts’ and replace all old names with new ones.

  • Open terminal and run command to edit the file:
    sudo nano /etc/hosts

When file opens in terminal, delete all the old hostname and insert the new name you set. Also, press Ctrl+X, type y and hit Enter to save change.

Liferea finally announced the first release candidate for the next stable release line 1.14. Here’s the new features and Ubuntu PPA packages.

Linux Feed Reader, Liferea in short, is a GTK3 new reader for Linux. It’s in the 1.13 pre-release series for more than 2 years, until released 1.14 RC1 few days ago.

The new release fixed an annoying bug that certain desktop environments or themes may make the pane invisible and hard to restore.

Now Liferea will never allow the panes to be smaller than 5% in height or width regarding to there orientation. If a pane is smaller than 5% height/width it will be set to 30% width or 50% height on startup.

Other changes in Liferea 1.14 rc1 include:

  • Supports gtk-application-prefer-dark-theme based dark mode switching.
  • Add search rule to find items from a given author.
  • Exported OPML feed lists are now UTF-8 encoded for better readability.
  • Render <media:description> field for Youtube feeds
  • Updated default feed sources from HTTP to HTTPS.
  • Add new “podcast” search folder rule.
  • Also add enclosures when saving items to file.

Liferea with GNOME style header bar

How to Install Lifera 1.4 RC1 in Ubuntu:

For Ubuntu based user prefer the classic .deb package, here’s the unofficial PPA contains the new packages for Ubuntu 20.04 and Ubuntu 22.04.

1. First, press Ctrl+Alt+T on keyboard to open terminal. When it opens, run command below to add the PPA:

sudo add-apt-repository ppa:ubuntuhandbook1/apps

2. Next, either update the feed reader from an existing release via “Software Updater” or run command below to install it:

sudo apt install liferea

NOTE: Linux Mint user need to first run sudo apt update to refresh package cache manually.

NOTE: Liferea still shows v1.13.9 in about dialog for unknown reason. Unknown if it’s building issue or a software bug, and I’ve report it to the project page.

Uninstall:

For any issue, you may uninstall the PPA repository by running the command below in terminal:

sudo add-apt-repository --remove ppa:ubuntuhandbook1/apps

And remove the Liferea news reader either via your system package manager or by running command below in terminal:

sudo apt remove --autoremove liferea liferea-data

This simple tutorial shows how to enable and customize hot-corner actions in Ubuntu 22.04 LTS with default GNOME desktop.

Your system can do a custom action, when moving mouse corner to hit one of the 4 (top-left, top-right, bottom-left, and bottom-right) screen edges. That’s hot-corners function.

By default, the top-left hot-corner is enabled for triggering the overview screen. You can however enable all the 4 corners and specify custom actions via an extension in all GNOME based Linux.

Step 1: Install Extension Manager

For Ubuntu 22.04 & 22.10, it’s easy to install and manager extensions via “Extension Manager” tool. First, search for and install the tool from Ubuntu Software app.

Install Extension Manager in Ubuntu 22.04

After that, click on top-left ‘Activities’ button to open overview screen. Then search for and open the ‘Extension Manager’ app.

Step 2: Install Custom Hot Corners extension

Once ‘Extension Manager’ opens, navigate to ‘Browse’ tab. Then, search for and install ‘Custom Hot Corners – Extended‘ extension.

Install Hot Corners Extension via ‘Extension Manager’

After installed it, switch back ‘Installed’ tab and click on the gear button to configure hot-corners.

Open Hot Corners settings

Under ‘Monitor‘ tab, choose one of the 4 corners via first row icons. Then select an action to do via the drop-down menu right below.

As you see, it also support custom actions for “Ctrl + mouse hit hot-corner”, “mouse click or scroll on corner”, “Ctrl + click or scroll on corner”.

And you can specify following actions to do with the extension: Show Activities overview, show app grid, run custom command, launch screenshot UI, hide all app windows (current or all monitors), switch workspaces, navigate windows, toggle screen brightness, nightlight, video playback control and more.

The extension is a bit overloaded in my opinion as it also support adding keyboard shortcuts and custom menu for all supported actions, though you may just skip to leave them all disabled.

This simple tutorial shows how to easily setup OpenVPN in your Ubuntu 20.04 | 22.04 server and connect remotely in Windows or Linux with GNOME.

My PPTP and IKEv2 VPN server refused to work recently due to the Great Firewall (maybe). So I decided to setup OpenVPN in my Ubuntu VPS as a workaround.

DigitalOcean has a step by step setup guide, but it’s really long and complicated for beginners. Thankfully, there’s a free open-source script make things as easy as few commands.

Step 1: Install OpenVPN

As mentioned, there’s a script in the github to make things easy. It automatically detects your system, environment variable, IP address, and setup OpenVPN and firewall.

The script is totally safe in my own opinion, and you can view the code by yourself. Though, there’s always disclaimer that use it as your own risk!

1. First, connect to your Ubuntu/Debian server either via SSH or other method that you favorite. Then grab the script by wget:

wget https://git.io/vpn -O openvpn-install.sh

In case wget command does not exist, install via sudo apt install wget.

2. After downloaded the script, add executable permission via command:

chmod u+x openvpn-install.sh

3. Finally, run the script:

sudo bash openvpn-install.sh

It will ask you a few questions to confirm IP address if your server is running behind NAT, choose UDP or TCP, set which port to listen to, and select a NDS server. For lazy men, it’s OK hit Enter to use default for all previous questions.

But, you need to finally type a name for the client. It will create a .ovpn file with the name you just typed.

Default options are usually OK except the client name

After answering all the questions, hit any key to get start. It will do all the remained things, and generate a .ovpn file.

Step 2: Copy & paste the .ovpn to client machine

As the screenshot above shows you, it generates the .opvn file in /root directory in my case. In case you logged in via non-root user, copy the file to user’s home via:

sudo mv /root/*.ovpn ~/ && sudo chown $USER:$USER *.ovpn

Finally, you need to send the file to client machine, such as running the scp command below in your client PC (run this command in client/local machine):

scp -P 22 username@server-ip:~/*.ovpn ./

Replace * with the filename, though it works if there no other .ovpn files. And, change port number 22 if non-default SSH listening port in use.

Step 3: Connect to OpenVPN server in Ubuntu/Fedora

GNOME desktop has built-in client support for OpenVPN connection. Simply open Gnome Control Center (aka Settings) via the top-right corner system status menu.

Then, go to ‘network’ in left pane, and click on ‘+’ after VPN section. Finally, click ‘Import from file…’

In the pop-up file selection dialog, choose the .ovpn file you got from the server side. It will generate the VPN network automatically once you click open (see the screenshot below).

It automatically create the VPN network after selected the .ovpn file

The default configurations are OK, though you may click editing advanced options as you need. After clicking on ‘Add’ button, you can finally start connecting to the OpenVPN server either within Gnome Control Center or system status menu:

Connect from Windows & macOS:

OpenVPN website provides a client application for Windows and macOS users, simply download and install the app. Then, drop the .ovpn file into app window to create VPN connection.