January 6, 2026

Setting up Ubuntu 24.04.x LTS desktop and server, RStudio server, and JypyterLab at home

Why? Set up a Linux server computer on a home network if:

  • You want to run code that takes a long time to complete. Let it run on the server computer so you can use your main computer for other things.
  • Your main computer is low on storage space. Upload all data files to the server and you can run analysis on the server remotely, e.g. from a laptop while you sit on your couch.
  • You want a server specifically for Linux (e.g. for bioinformatics or programming purposes), whereas your main computer is Windows or MacOS.

Who? This tutorial is intended for computer-savvy people with enough patience and knowledge to troubleshoot their own computer by searching the internet for error codes and following instructions. Ideally, you should have some programming experience (beginner level in any language is enough) and know about terminals or command prompt windows, but you can learn what you need as you go. This is a great hands-on way to learn to use Linux. Expert Linux knowledge is not a prerequisite. 

What? Ubuntu Desktop 24.04.x LTS "Noble Numbat" (or the latest version), OpenSSH for server capabilities, RStudio server, and Jupyter Lab. Ubuntu is a specific version of Linux.

Cost? All the software is free. For hardware, you need the following:


  • "Main" computer to help you -- this computer won't be changed
    • Any time I refer to "main computer", I mean some other computer or laptop that you can access.
    • It is needed to download files, prepare the executable USB drives, check that the server works, and search the internet for help.
    • I used my personal computer running Windows 11.
  • Second computer to become the server -- this computer will be erased/overwritten
    • Save anything you want to keep somewhere else, including data, bookmarks, and software licenses. Everything will be erased during the setup process.
    • The operating system (e.g. Windows 11) will also be erased/overwritten.
    • For first time or casual projects, I strongly recommend using an old desktop or laptop that you already have (anything 1-15 years old and 64-bit), instead of spending extra money. Linux supports old technology very well and can extend the life of hardware that no longer supports the latest Windows version. If you have problems, try an older version of Ubuntu before you give up, e.g. Ubuntu Desktop 22.04.4 LTS or even Ubuntu Desktop 20.04.4 LTS.
    • For users who need a dedicated server for work, you may want to shop for a "workstation" computer (faster processors and better RAM than "desktop" computers). I recommend buying hardware manufactured in the last 1-5 years for the best Linux compatibility. Check the Ubuntu Certified list for compatible hardware but don't limit yourself to that list since it focuses on business customers and bulk-order computers. Ubuntu will work on most consumer marker computers also.
    • For advanced users, you can build your own custom computer with the help of PCPartPicker.com and various online communities such as r/buildapc. However, beware that Linux may not immediately work well with the newest technology (< 1 year old) since computer hardware manufacturers focus on Windows users. You may find yourself troubleshooting a lot of hardware incompatibilities and missing drivers for 2.5 Gbps Ethernet ports and the latest Nvidia graphics cards. The Linux community is very helpful and you will find a lot of solutions in forum posts, but the extra work may be discouraging for a first time server owner.  
  • Empty USB drive
    • This will be erased/overwritten to make bootable USB drives to erase & install things on the server computer
    • Afterward, you can reformat back to a regular USB drive for file storage
    • The storage amount is dictated by the .iso file you are installing: 
      • 4 GB is ok for Ubuntu server installation files
      • 8-16 GB is needed for Ubuntu desktop since it has more software (recommended)
  • Internet access for both computers. Wifi or wired Ethernet. Sometimes one method works better than the other, depending on the computer hardware and the default drivers included in the .iso installation file.
  • Keyboard, mouse, and monitor (only necessary for setup)
    • Directly connect your existing keyboard, mouse, and monitor to the server computer. This can be temporary just for setup steps. Use what you have or borrow for a few days. 
    • Alternatively: I used a Linux-compatible USB switch and cheap no brand VGA switch so I could use the same keyboard, mouse, and monitor for both my main (Window) and server (Linux) computers. 
    • Alternatively 2: You can also use a tiny $9 keyboard+touchpad combo for the server computer. I tried this but didn't like it long-term because it is too small and uncomfortably slow to use.

How? My setup notes for Ubuntu 24.04 LTS are below. See older posts for Ubuntu 22.04 LTS and 20.04 LTS.


Table of contents


Prepare an executable USB drive to install the Ubuntu desktop

  • Detailed instructions with screenshots [WikiHow]
  • Download an .iso file containing the installation files for your desired version of Ubuntu. 
    • For example: ubuntu-24.04.2-desktop-amd64.iso (desktop version)
    • Check for the most recent LTS release at the main Ubuntu website. LTS = long-term support, so you don't need to upgrade as often.
    • Download the .iso file to anywhere (main computer, USB flash drive, the cloud).
    • .iso files are packaged files that will be used to make installation CD-ROMs or executable USB drives. 
  • USB drive to become the executable USB: get a USB flash drive that you're ok erasing completely. 
    • If you downloaded the .iso file to a USB flash drive, then you need a second USB flash drive that you are ok erasing. You can't use the same USB flash drive.
    • USB drive #1 = storage of the downloaded .iso file, does not need to be erased. 
    • USB drive #2 = to be erased and rewritten with the .iso file contents (will become an executable USB).
  • Create the executable USB: use Rufus (freeware), the .iso file, and your USB drive that you are ok erasing completely. The goal is to place all the installation instructions inside that USB drive so that you can install Ubuntu.
    • Run Rufus on your main computer, with your soon-to-be-executable USB drive plugged in.
    • Install the .iso file ("boot selection") onto the USB drive ("device") that you want to make executable. Use default settings, plus one addition from advanced settings: check the box for "Add fixes for old BIOSes (extra partition, align, etc.)"
    • If Rufus says your .iso file needs a different Grub and asks if it can download it for you, say yes and continue.
    • The final executable USB can be used during computer start up to run the .iso data, but it is still safe to plug into a computer that is already turned on (and therefore won't run the .iso data). If Windows asks what you want to do with it, select "view contents".
Image shows installation of Ubuntu Studio, not Ubuntu server, but it's very similar. "Device" is your USB drive. Use "Select" to load your ISO file.



Install the desktop operating system (Ubuntu 24)

  • Use an old computer that you are ok erasing completely.
    • Beware: you shouldn't have any files or software you want to keep on it!
    • You will lose the Windows or iOS operating systems, too!
    • Back up anything you want to save to an external hard drive or the cloud.
  • Optional (recommended if donating the computer): erase the hard drive with DBAN software
    • Download the DBAN .iso file (free) and create an executable USB drive using Rufus
    • Optional step because installing the Ubuntu server overwrites the hard drive anyway
    • If your old computer has an HDD drive: you can use DBAN to overwrite the hard drive several times and ensures your original data can't be recovered.
    • If your old computer has an SSD drive: nevermind. DBAN doesn't work well on SSDs.
  • Reboot the computer
    • Disable "fast restart" if you have Windows 8 or later
    • Starting with Windows 8, computers have a "fast restart" mode that skips your opportunity to enter the BIOS menu when you start it again.
  • Enter the BIOS menu by repeatedly tapping the appropriate keyboard key as soon as you press the power button. Keep holding it for several seconds and tapping it until the BIOS menu appears.
    • Search the internet for your computer manufacturer's specific instructions on how to enter the BIOS menu. It is usually the F1, F2, F10, or DEL key.  
    • May require rebooting the computer several times to get it right.
    • If you see the Windows screen, shut down and try again.
    • Timing is key! Your opportunity to enter the BIOS is a really short window at the very beginning of start up.
  • Edit the boot order in BIOS settings: we need the computer to boot from USB drive.
    • Turn off BIOS safety settings that prevent booting from USB, if any.
    • Turn off Windows secure boot.
    • Change the boot order to boot from USB drive before anything else (hard drive, CD, etc).
    • Getting the computer to actually run the executable USB is the most difficult part because it is very computer model-specific. Companies add a lot of security measures to make this hard. Look up your specific computer model if you have problems.
    • Don't quit at this step! The rest is easier!
  • Shut down the computer completely after adjusting BIOS settings
  • Plug in the executable USB drive that you created with Rufus and the Ubuntu .iso installation file.
  • Turn on the computer
    • It should boot from the USB and start the Ubuntu installation.
    • If not, try holding F2 or F12 when turning on the computer. You may need to adjust more BIOS settings until it works.
  • Follow installation instructions. The first few minutes are just waiting for the screen of automatic tasks to complete. Eventually you get a text screen that says welcome.
    • Yes, connect to internet if possible. It makes everything easier!
    • Yes, install "recommended proprietary software". This ensures your graphics card, Ethernet port, and other hardware will work well. 
    • Select "Erase disk and install Ubuntu" to use your whole disk. Beware that Ubuntu will ask to install in the largest storage drive, if you have more than one. I had two drives and my larger capacity HDD drive was selected by default, so I changed to my SDD for faster computer performance. Ensure the correct disk is selected.
    • Select a unique computer name with no spaces. The name should be unique on your home internet network. Later, you will ssh into your server with this computer name. Make it memorable and easy to spell for everyone who will use your server.
    • Otherwise, default settings are fine.
  • Remove the executable USB drive once the installation is complete. 
    • If you don't, the computer will restart and boot from the USB again. You will get a message to "remove installation media" (remove the executable USB). Do that, then hit [Enter] to continue.
    • Keep the executable USB nearby until you finish and everything works. If something goes wrong, you can re-install.
  • After all is done, you can reformat (erase) the executable USB with your main computer to use it like a normal USB storage drive again.
    • It is safe to plug in when the computer is already turned on. It was created to execute on start up and will not execute when you plug it in any other time.
    • Just in case, if your main computer is confused and asks if you want to import contents or run the ISO, click "Cancel" or "No". If your main computer asks if you want to reformat the USB drive, say "OK" or "Yes".

If you started with Ubuntu Server:
Set up a desktop (GUI) for the server

  • No longer recommended! See my older Ubuntu 22.04 LTS instructions if needed.
  • Technically, you can start with either the Ubuntu Server or the Ubuntu Desktop installation, then add the other part so that you end up with both a server and desktop. 
  • In theory, the installation order doesn't matter. 
  • In practice, the server .iso file has less hardware drivers included and you may have trouble connecting to internet or getting your graphics card to work, especially if your computer is very old or very new.

If you started with Ubuntu Desktop:
Set up server capabilities with OpenSSH

Open the "Terminal" app and type in this command in bold to check your internet hardware and local IP address:

ip a

Ethernet = eth0, enp2s0, enp4s0, and similar patterns

Wifi = wlp3s0, wlp7s0, and similar patterns

Now check that you can actually connect to the internet with this command in bold:

ping 8.8.8.8 -c2

This pings Google.com's DNS server at IP address 8.8.8.8 with two random data packets. If you have internet access, you will see "2 packets transmitted, 2 received, 0% packet loss".

If internet works, continue by updating your system and installing OpenSSH:

sudo apt update && sudo apt upgrade
sudo apt install openssh-server


The prefix "sudo" means that you are running the commands with administrator authority, similar to Window's "Run as administrator". Ubuntu will ask for your password to continue.

Add expanded security maintenance

Make an account to log into https://ubuntu.com/pro/dashboard

Under section "Free Personal Token", follow the instructions to attach your security token to your Ubuntu server and up to 4 other machines (5 total). The command looks like this:

sudo pro attach [your security token]

Doing this will enable the esm-apps repository which has extra bug fixes and security packages. 

ssh -V 


Change the ssh port from the default 22 to something else (pick a number, e.g. 23). 
sudo nano /etc/ssh/sshd_config
  • Find the line that says "#Port 22". 
  • Remove the hashtag and change the number to something other than 22.
  • Don't use these ports for ssh. They are used for something else already:
    • 20 (ftp-data)
    • 21 (ftp server)
    • 22 (default ssh port, often targeted by bots and hackers)
    • 23 (telnet server)
    • 25 (email server)
    • 53 (DNS server port for rerouting internet traffic)
    • 69 (tftp server)
    • 80 (internet http port)
    • 110 (POP3 server)
    • 123 (NTP server)
    • 443 (internet https port)
    • 465 (SMTP over TLS, for email sending)
    • 512 (syslog logging service)
    • 587 (SMTP over TLS, for email sending)
    • 631 (CUPS printing service)
    • 993 (IMAP over TLS, for email receiving)
    • 3306 (MySQL / Maria DB database server port)
    • 5000 (Flask / API dev server port for local web services)
    • 5432 (PostgreSQL database server port)
    • 6006 (TensorBoard ML visualization port)
    • 8000 (Flask/Django dev server port)
    • 8080 (web server and proxy port)
    • 8787 (RStudio server port)
    • 8888 (Jupyterlab server port)
  • To save changes: Ctrl+O and press [ENTER]
  • To exit the text editor: Ctrl+X
  • The file is changed, but changes are not active until you reload the configuration file. We will do that after this following step.

Disable root login for ssh

You only want to use temporary root access by using "sudo" commands, but you don't need to login as root. Disable the ability to login as root for increased security.

Again open the configuration file: 
sudo nano /etc/ssh/sshd_config

Add this line without a hashtag in front:
PermitRootLogin no

To save changes: Ctrl+O and press [ENTER]

To exit the text editor: Ctrl+X

Apply changes to the ssh configuration file:

Start and/or reload the sshd service to apply changes, then check status:

sudo systemctl start ssh
sudo systemctl reload ssh
sudo systemctl status ssh 
Cntr+Z to quit the status window 

If the status message still says that the server is listening on the default port, port 22, then stop and restart the ssh server a different way:  

sudo systemctl stop ssh
sudo systemctl start ssh
sudo systemctl status ssh 
Cntr+Z to quit the status window 

You should see that the server is listening on your desired port now. 

If not changed, reboot and check again:

sudo reboot
sudo systemctl start ssh
sudo systemctl status ssh

Enable the ufw firewall and allow traffic through specific ports:

Identify your local IP address in the output after "inet". Only type the bold. The text after the hashtag (#) is a comment. 

ip -4 addr | grep -E "wlan|wifi|wl" #check your local IP address after "inet"

Your local IP probably begins with "192.168.0" or "192.168.1".

Note that the long vertical bar "|" means "or" in programming languages and you can type it with Shift+\ on your keyboard. The backslash key is usually located above the [Enter] key.

Enable the firewall, open select ports for web services, and apply new rules:

sudo ufw enable #turns on the firewall
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow www #allow internet access through ports 80 and 443
sudo ufw reload #apply the rules
sudo ufw allow 8787/tcp #RStudio server port on public internet (not recommended)

Open ports you are using for ssh access (example uses 22) and RStudio server (port 8787), but only allow access from your local home network IP addresses: 

sudo ufw allow from 192.168.0.0/24 to any port 22
sudo ufw allow from 192.168.1.0/24 to any port 22

sudo ufw allow from 192.168.0.0/24 to any port 8787 #RStudio server port
sudo ufw allow from 192.168.1.0/24 to any port 8787 #RStudio server port
 

Replace "22" with whichever port you are using for ssh access. The default port is 22.

Replace the IP address with your home network range if needed, though 192.168.0.x and 192.168.1.x are common patterns. This is not the same as your public IP address visible to people on the internet. The "/24" at the end is the same as saying the last number can vary.

DON'T do the "ufw allow from" version of the terminal command for the internet ports or you may lose internet access.

Reload the firewall to apply the rules:

sudo ufw reload #apply the rules 

View which ports are open:

sudo ufw status verbose #more details
sudo ufw status numbered #supplies a numbered list

Delete any rules you don't want using the line <number> (without the greater/less than signs):

sudo ufw delete <number> 

Delete any rules by port name. I suggest deleting any lines for port 22, which may have been opened automatically if at any point you ran "sudo ufw enable ssh".

sudo ufw delete allow 22 #default ssh port


To delete all ufw rules and start over:

sudo ufw reset
sudo ufw enable #turns on the firewall again

 

Add security to the server (fail2ban)

Install and enable package "fail2ban" which automatically blocks IP addresses that try to brute force login into your server with multiple attempts. After a certain number of failed attempts, fail2ban prevents further tries. Read the configuration instructions here before enabling fail2ban.

sudo apt install fail2ban

systemctl status fail2ban.service # check status info. It will be inactive by default. Ctrl+Z to return to terminal.

sudo systemctl enable fail2ban
sudo systemctl start fail2ban


Create a fail2ban filter using systemd support. Begin by creating the file:

sudo nano /etc/fail2ban/filter.d/rstudio.conf

Fill the file contents, for example:

[Definition]
failregex =
Authentication failed
auth.*failed
ERROR.*Authentication
ignoreregex =

 

Save the file and close with Ctrl+O, [Enter], and Ctlr+X.

Create a jail for failed login attempts. Begin by creating the file:

sudo nano /etc/fail2ban/jail.d/rstudio.local

Fill the file contents:

[rstudio]
enabled = true
port = 8787
protocol = tcp
filter = rstudio
backend = systemd
journalmatch = _SYSTEMD_UNIT=rstudio-server.service
maxretry = 3
findtime = 600
bantime = 86400
banaction = ufw

Save the file and close with Ctrl+O, [Enter], and Ctlr+X.

Then enable the changes:

sudo systemctl restart fail2ban
sudo fail2ban-client reload
sudo fail2ban-client status

View the log for failed attempts:

sudo grep -i rstudio /var/log/syslog
sudo grep -i "authentication failed" /var/log/syslog 
sudo journalctl -u rstudio-server | grep -i auth


More reading about fail2ban:


Set up a static IP address for the server computer

What is a static IP and why is it useful? It is an IP address that does not change. Having a static IP address is useful for a server computer (or printer) so that other computers have a known address to interact with it. Setting up a static IP is accomplished on a private network by telling the internet router to always assign the same local IP address to a specific MAC address (the physical hardware identification). Reserving an IP address for the server computer makes certain things easier, such as accessing the server via ssh or RStudio server web interface.

There are two IP addresses for internet-connected equipment:
  • Local IP address - assigned by your internet router to everything that connects to it, usually starts with 192.168.0.x or 192.168.1.x, where the number x varies. This local address changes as things get disconnected and re-connected, but you can reserve specific local IP addresses for specific equipment MAC addresses for free. 

  • Public IP address - assigned by your internet service provider, find yours at whatismyIP.com. This is what websites see when you visit them. Unless you pay for premium internet service that specifically offers this feature, your public IP is not static.

For the purposes of a private home Ubuntu server, you only need a static local IP address. It doesn't matter if your public IP address changes. 

  • Identify the MAC addresses for the Ubuntu server computer with this terminal command:
    • ip a

  • MAC addresses look like letter and number pairs in this format, A0:A0:A0:A0:A0:A0 
    • Ethernet and wifi have different MAC addresses.
    • Write down both and then see which one is connected to the internet router

  • Log into your internet router's admin website to set up a static IP address ("reserve an IP address") for the Ubuntu server.
    • This requires administrative access to the internet router. Ask whoever set up the internet for help, or check the back of your internet router for default login information.
    • Here are default router addresses, usernames, and passwords.
    • Instructions to reserve IP addresses vary by manufacturer.
    • Check under "LAN Setup" and find a section called "Address Reservation"
    • Check under "Network" > "DHCP Server" > "Address Reservation". 
    • If you still can't find it, search "how to reserve IP address printer __[your router model]__" and follow those instructions for the Ubuntu server computer. Printers are the most common equipment that needs a static IP, so printers will have the most help pages on this topic.
  • If you reserved a different IP address than the one you were randomly assigned, reboot the server computer to apply the change.
    • sudo reboot

Log into the server remotely via ssh

  • On the server computer, turn on ssh access and check ssh server status (should be active)
    • sudo systemctl start ssh
    • sudo systemctl status ssh
    • Cntr+Z to quit the status window

  • On the server computer, ssh into the "localhost" (not an IP address, do not replace) and then exit
    • ssh localhost -p <port>
    • Replace <port> with your ssh port number, default is 22
    • For example:
      sudo myusername@servercomputername -p 22
    • At first connection, you will be told "The authenticity of host '[your computer server info]' can't be established." That is expected and normal. Say "yes" to continue connecting.
    • exit

  • On the main computer (or any other computer on your local network), open a terminal and type something like: 
    • On Windows, you can open a terminal like this:
      • WindowsKey + R, then type "cmd"
      • Or search "cmd" and click Command Prompt
    • Alternatively, use MobaXterm software (free version) or PuTTY (freeware) to interact with the server.
    • ssh <username>@<localhost> -p <port>
    • ssh myusername@192.168.0.10 -p 22 #for example
      • Replace <username> with your username on the server
      • Replace <localhost> with your server computer name or its static local IP address. Either works.
      • Replace <port> with your ssh port number. See the section on increasing server security by changing the ssh port number. The default port is 22.
    • If using MobaXterm or PuTTY, fill in the boxes for username, IP, and port number.

  • First time message will look something like this: "The authenticity of host '[192.168.0.10]:22 ([192.168.0.10]:22)' can't be established. ECDSA key fingerprint is...."
    • Say "yes", you want to continue connecting. 

  • If it works, you will see "Welcome to Ubuntu 24.04..." and information about the server, including how many updates are available.

  • The terminal should ask for server login information.

  • SECURITY NOTE: if your server does not yet have a firewall installed, I suggest turning off the ssh server when not in use, either by shutting down the computer or with the following:
    • sudo systemctl stop ssh
  • You can start the server services again with:
    • sudo systemctl start ssh

Troubleshoot ssh issues

  • https://likegeeks.com/ssh-connection-refused/
  • https://www.webservertalk.com/troubleshoot-ssh-connection-refused
  • https://ubuntu.com/server/docs/service-openssh
  • Check the server IP address to verify that you are attempting to ssh to the correct IP
    • ip route
  • Check that the server computer has internet access at all
    • ping 8.8.8.8 -c2 
    • This sends two packets to check for a connection. Note: there is no space between c and 2
    • Check for 0% packet loss which means the internet works
    • If there is packet loss, then troubleshoot your internet connection
  • Check that the server computer DNS is rerouting internet traffic correctly
    • ping google.com -c2
    • Check for 0% packet loss which means the DNS is working correctly AND you have internet
    • If the ping to 8.8.8.8 works, but the ping to google.com fails, then you have a DNS resolution error. This happened to me after rebooting my original Ubuntu server 20.04 LTS computer and I ended up reinstalling the whole server because nothing seemed to fix it. If it happens to you, try rebooting the internet router! I did not try that.
  • If you have a firewall enabled on the server computer (instructions for that later), make sure you opened the ssh port. Don't type the comments after the hashtag (#).
    • sudo ufw allow ssh #enables default port 22
    • sudo ufw allow 10/tcp #where 10 should be replaced with whatever port you are using for ssh if not the default port 22
    • Later, delete these ufw rules and replace with more secure firewall rules.
  • Temporarily disable the server firewall. Does that allow you to ssh into the server computer? If yes, then it's a firewall issue and you will need to edit the firewall rules.
    • sudo ufw disable
  • Check that your main computer's firewall allows internet access to whatever program you are using to ssh into the server, examples:
    • Windows command prompt (cmd.exe)
    • Windows Subsystem Linux (wsl.exe)
    • PuTTY - a free ssh client that you may want to try if the Windows command prompt isn't working and you don't have Windows Subsystem Linux
  • Create a second server account with less privileges and attempt to ssh from that account
    • otheruser@serverIP #assumes default port 22
    • otheruser@serverIP -p 10 #tries port 10 (replace "10" with your ssh port number) 
  • Remove OpenSSH and reinstall. 
    • sudo apt-get purge openssh-server
    • sudo apt-get autoremove #cleans up dependencies not used by anything else
    • sudo apt-get autoclean #cleans up more leftover unused files
    • sudo apt-get update 
    • sudo apt-get upgrade
    • sudp apt install openssh-server #reinstall
    • sudo systemctl start ssh #start the ssh server
    • sudo systemctl status ssh #check status
  • If using your main account, try permitting root login temporarily. Not recommended as a long-term solution since it makes the server less secure. 
    • sudo nano /etc/ssh/sshd_config
    • Type this line without any hashtag (#) in front:
      • PermitRootLogin yes
    • [Ctrl+O], [Ctlr+X] to save and exit
    • sudo systemctl restart ssh
    • Set up a firewall rule limiting IP addresses to the ssh port if you want to keep this setting.
  • Reboot the internet router if nothing else works. When I had ssh issues, rebooting the internet router fixed these error messages:
    • "Resource temporarily unavailable" from Windows Subsystem Linux
    • "Connection timed out" from Windows 10 command prompt


Install R program [1/2026 update]

My instructions below are for Ubuntu Server 24.04.x LTS, modified from the official R instructions [CRAN] and some from here to remove the old R version [thinkr.fr].


Check if you have R already (usually you won't)
R --version
 
 
Remove old R version if needed 
 
Don't type the #comments. Those are just notes for you.

sudo apt-get purge r-base* r-recommended r-cran-* #remove old pre-installed R version

sudo apt autoremove #remove dependencies not used by anything else

 

Install latest R version 

Don't skip installing the development packages. If you only install r-base, you will have problems with missing dependencies when you try installing R packages in the future.

sudo apt update -qq #updates with less wordy output

sudo apt install --no-install-recommends software-properties-common dirmngr #installs two helper packages

wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | sudo tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc  # add signing key, note the qO has a capital letter O, not number 0

sudo add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/" 

 This step tell Ubuntu where to download the newest R version.
Note, "focal" is for Ubuntu 20.x versions, "jammy" is for Ubuntu 22.x versions, "noble" for Ubuntu 24.x, or you may need a different version.

Using $(lsb_release -cs) automatically selects the correct release name.

sudo apt install r-base r-base-core r-recommended r-base-dev   #install R

sudo apt install cmake libcurl4-gnutls-dev libfftw3-dev libfontconfig1-dev libfreetype6-dev libssl-dev libpng-dev libtiff5-dev libjpeg-dev libwebp-dev libxml2-dev #development packages required for R package devtools and other development tools

sudo apt install libcurl4-openssl-dev libharfbuzz-dev libfribidi-dev ## optional, required for tidyverse R packages 

sudo apt install libmagick++-dev  ## optional, required for R package magick for graphics 

sudo apt install  libpoppler-cpp-dev ## optional, required for R package pdftools to use pdf files

sudo apt install libcairo2-dev ## optional, required for R package svglite to save .svg images

sudo apt install libtesseract-dev libleptonica-dev tesseract-ocr-eng ## optional, required for R package tesseract for image-to-text processing

R --version #check for the latest R version. If you have an older version, start over from the purge line. 

R #enter the R shell

 Type any R code you want in the R shell.


          q()  #exit R shell. Can also use Ctrl+Z to exit.


Identify additional dependencies for R packages in RStudio output

Keep watch for "ERROR: configuration failed" and "non-zero exit status" errors when installing R packages. Often, there are missing dependencies that caused the R package to fail installation. Check the text around the error to identify which additional development packages you need to install from the Linux terminal. This example is very clear about what we need to install:

Attempted installing "pdftools" R package through RStudio, but I am missing a dependency that I need to install through the Ubuntu terminal.
I attempted installing "pdftools" R package through RStudio, but I am missing a dependency that I need to install through the Ubuntu terminal. I need to run "sudo apt install libpoppler-cpp-dev" through Ubuntu terminal.


However, sometimes the error messages are less clear. For example below:

For this error, I searched the internet to find out what development package provides "gsl/gsl_rng.h". I solved the error with "sudo apt install libgsl-dev".


R install finished

After this, I found that Ubuntu automatically updated my version of R when I ran regular maintenance updates with:

sudo apt update
sudo apt upgrade
sudo reboot #this restarts your computer so save any files you need!



Install RStudio server [1/2026 update]

Installation instructions for Ubuntu 24.04.3 LTS. See link below for the latest filenames:
https://rstudio.com/products/rstudio/download-server/debian-ubuntu/

sudo apt install gdebi-core

wget https://download2.rstudio.org/server/jammy/amd64/rstudio-server-2026.01.0-392-amd64.deb

sudo gdebi rstudio-server-2026.01.0-392-amd64.deb #select Y to continue install

sudo ufw allow from 192.168.0.0/24 to any port 8787 #skip if firewall not enabled
sudo ufw allow from 192.168.1.0/24 to any port 8787 #skip if firewall not enabled

sudo systemctl status rstudio-server #check that it's working

Cntr+Z to exit the status window


Check the RStudio server version:

rstudio-server version

First time setup for each user: ssh into the Ubuntu server from your main computer and add the server IP to your list of known hosts by answering yes to the question, "Are you sure you want to continue connecting (yes/no)?" You MUST be able to successfully ssh into the Ubuntu server before you can use the RStudio server.

From the main computer (not the server computer), either through the Windows 11 command prompt or ssh software (PuTTY or MobaXterm):
ssh username@serverIP #assuming the using default port 22
ssh username@serverIP -p 10 #example if ssh uses port 10

Log into the RStudio server from your main computer using a web browser, the server IP, and port 8787 [more info]:

http://<your server's IP>:8787

http://<your server name>:8787   # this also works

The login is your Ubuntu username and password. 

Troubleshooting: if you can ssh into the Ubuntu server, but get a browser error saying the RStudio server website "took too long to respond", try this:

sudo systemctl status rstudio-server #check if RStudio is working
    Ctrl+Z keyboard shortcut (not terminal code!) to close out systemctl 

sudo systemctl start rstudio-server #only needed if status said it was inactive

Try to log in again. Make sure you are using "http://" and not "https://"

Install Perl, Python and JupyterLab

  • No need to install Perl and Python! They are already installed with Ubuntu.
  • Check the versions with 
    • python3 --version  #two hyphens
    • python2 --version 
    • perl --version
  • Install pip if needed for python
    • sudo apt install python3-pip
    • pip3 --version
  • Upgrade pip
    • sudo apt update
    • python3 pip -m install --upgrade pip
  • To exit either terminal if you're stuck, use Ctrl+Z or quit()
    • ">>>" means you are in the Python shell
  • Install JupyterLab (a Python GUI):
    • pip install jupyterlab
  • Detailed video instructions for installing Jupyter for a server [YouTube 2019]
  • Install Spyder (a Python GUI):
    • sudo apt install spyder

Install Dropbox [6/2024]

Install through the terminal: 

sudo apt install nautilus-dropbox

A pop-up window will come up. Sign in and select your preference settings.  

Check the status with:

dropbox status

After rebooting, Dropbox sometimes needs to be restarted manually. You can do this remotely from a terminal using:

dropbox start

To set up Dropbox to start automatically upon login, use this command:

dropbox autostart y

See more Dropbox terminal commands from the official source or with this command:

dropbox

 


Make your whole hard drive space available [8/2021]

Optional section when getting started! I did this only several months later when Dropbox surprisingly told me I was out of space, when I knew the drive shouldn't be full yet. 

Technical details: Your workspace inside the Ubuntu server is a "logical volume" inside ext4-formatted partition sda3. Ubuntu automatically limits the aliquoted disk space to less than your total hard drive space.
 
Layman explanation: Ubuntu automatically limits the space available to your user account so that there is space available in case you add other users later. If you're the only user, though, you don't need this limitation. You can tell Ubuntu to give you all the space.

Check your storage allocations (doesn't change anything, just informational):
 
df -h #see file sizes in human readable format

cfdisk #shows all partitions on the hard drive and space used

Note: "sda" prefixes refer to your internal storage such as your hard drive, "sdb" prefixes refer to external storage such as USB drives.

du -sh ~/Downloads #see how much space your Downloads folder uses

du -sh ~/Dropbox #see how much space your Dropbox folder uses

df -h ~/Dropbox #see how much space is available, used, and free in this folder. Importantly, this also tells you where this folder is located on the hard drive.
 
sudo lsblk #shows virtual volume breakdown and which partition contains it

In my case, my Drobox folder was located in path "dev/mapper/ubuntu--vg-ubuntu--lv" (notice 2 hyphens, 1 hyphen, then 2 hyphens) in partition sda3. Write down the exact name of the virtual volume path because you will need it later! My system told me that 200 GB were available, even though my hard drive is 1 TB. 
 
Next, here are instructions that you should only follow after backing up your data (beware possible data loss if you have typos or mistakes):

I resized the logical volume (lv) to give it more space by following the instructions here, which I can confirm worked for Ubuntu server 20.04.2 on August 2021: https://slice2.com/2020/12/05/howto-easily-resize-the-default-lvm-volume-on-ubuntu-18-04/

Briefly, I first ran this test (-t) to see if I could resize the logical volume without errors:

sudo lvresize -t -v -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
 
I checked the output and it told me no errors were found.

This is the start of real changes to your system (so make sure your data is backed up): I repeated the command  above with "-t" removed to run it for real, not as a test. 

After running, I checked the file system type (expect ext4) and size:
 
df -h -T | grep vg
 
Since ext4 was correct, I proceeded with the final resizing step:
 
sudo resize2fs -p /dev/mapper/ubuntu--vg-ubuntu--lv
 
Check that it worked by checking the file system size again: 

df -h -T | grep vg

Restart the server and you are done with this risky section.


Install a remote desktop server


Install a Brother network printer using an IP address [2022]

Network printer = a printer connected to the internet. The printer is not connected to the computer via a USB cable or Ethernet cable.

  • Before starting, assign a static IP to your printer. This requires logging into the internet router admin page.
     
  • Install these dependencies on your computer before installing the printer drivers:
    • sudo apt install lib32zl #optional maybe
    • sudo apt install  lib32ncurses6 #replaces lib32ncurses5

  • Look up your specific printer on the Brother website, e.g. MFC-5460CN

  • Install the printer drivers [instructionsinstructions from Brother]
    • Download the "Driver Install Tool" file, e.g. "linux-brprinter-installer-2.2.3-1.gz", to the Downloads folder
    • These instructions helped me set up a network printer with 32bit drivers on a 64bit computer
    • In a terminal to install the printer drivers:
      cd ~/Downloads && gunzip -v ~/Downloads/linux-brprinter*
      sudo bash ~/Downloads/linux-brprinter*
       
    • Move some files to install the scanner files:
      sudo ln -sf /usr/lib64/libbrscandec*.so* /usr/lib
      sudo mkdir -p /usr/lib/sane
      sudo ln -sf /usr/lib64/sane/libsane-brother*.so* /usr/lib/sane
    • Add your username to the scanner user group, e.g. gonzalez:
      sudo usermod -a -G scanner gonzalez
    • If you get an error after a question about a proxy server, use the alternative method below.

  • Install the printer drivers -- alternative method if the above doesn't work. Installing the two .deb printer drivers separately.
    • From the Brother printer page, download the LPR printer driver and CUPSwrapper printer drivers separately (both .deb files). Install the LPR driver first, then the CUPSwrapper.
    • sudo mkdir /var/spool/lpd/
    • sudo mkdir /var/spool/lpd/mfc5460cn/
      • Replace the last step with whichever directory is missing. You'll see it as an error if you try to run the step below.
    • sudo dpkg -i --force-all mfc5460cnlpr-1.0.1-1.i386.deb
      • Replace the .deb filename with your specific LPR driver filename.
    • sudo dpkg -i --force-all mfc5460cncupswrapper-1.0.1-1.i386.deb
      • Replace the .deb filename with your specific CUPSwrapper driver filename.

  • You should see the printer installed (under "System > Printers"). Restart the computer if not.

  • The default printer settings assume you are connected by a USB cable. For a network printer, you need to change the device URI value. The default device URI value = usb:/dev/usb/lp0
  • If you have a static IP for your printer, change the device URI to specify the static IP address.
    • Go to "Printers" and right-click your device
    • Edit printer properties and find the device URI
    • Instructions: https://www.cups.org/doc/network.html
    • Example static IP = 192.168.0.3
    • The corresponding URI value = socket://192.168.0.3:9100

  • Print a test page.

Install an Epson network printer using an IP address [2023]

For Epson printers, install drivers with:
sudp apt install printer-driver-escpr

Open a web browser and access CUPS: http://localhost:631

Use the "Administrator" tab to add your printer. 


Suggested software

Suggested Ubuntu packages for bioinformatics

  • sudo apt install fastqc #quality checks
  • sudo apt install samtools #BAM tools



General maintenance [updated 12/2025]

Things to do occasionally to make things keep running well. Several of these things can be done through another computer logged in through ssh. After restarting, you may need physical access to the server or the internet router.
  • Identify your user account
    • whoami #returns your account name
  • Identify logged in users
    • w
  • Identify your Linux kernel (useful for hardware compatibility information) and Ubuntu version (useful for software compatibility):
    • uname -mrs && lsb_release -a
    • cat /proc/version_signature #alternative
  • Identify external drive, USB flash drive, HDD, or SDD location
    • RStudio server web portal starting from the Home work directory:
      dir("../../[username]/media/") 
    • Linux terminal:
      ls ~/../../media/[username]/ 
    • #replace [username] with your own username without the square brackets
    • You should see your external drive name
  • Identify your network interface card (NIC), the hardware that you use for internet connectivity
    • lspci -nn | grep -i ethernet
    • Look for "Ethernet controller" in the output
  • Identify which ethernet driver is being used
    • lspci -k | grep -A3 -i ethernet
    • r8169 = Realtek driver for 1 Gbps ethernet ports, might work for 2.5 Gbps ports but not well
    • r8125 = Realtek driver for 2.5 Gbps ethernet ports
    • igc = Intel driver
  • Internet speed test [other options]
    • sudo apt install speedtest-cli
    • speedtest 
  • Download & install updates (on the server computer or remotely)
    • sudo apt update #to check what is new, without installing anything
    • sudo apt upgrade #to install new versions of packages
    • sudo apt autoremove #to automatically remove packages that are no longer used
  • Restart if the ssh log in message says: "*** System restart required ***"
    • sudo reboot
    • You can do this remotely by ssh
    • You may need physical access to the server afterward if there are any issues with internet, firewall rules, or ssh. The most likely issue is that your need to check the IP address again if you didn't assign the server a static IP on the internet router yet.
  • Check your server IP address
    • ip a
    • enp2s0 = ethernet
    • wlp3s0 = wifi
  • Check devices connected to your local internet
    • sudo apt install arp-scan
    • sudo arp-scan --localnet
  • Check firewall rules
    • sudo ufw status
  • Restart Dropbox and check Dropbox status. I need to restart it often on Ubuntu server 20.04.03. It disconnects after a few hours of inactivity.
    • dropbox status
    • dropbox start
  • RStudio Server check status, start if inactive, restart if it is active but not working well
    • systemctl status rstudio-server
    • systemctl start rstudio-server
    • systemctl restart rstudio-server
  • RStudio Server - "took too long to respond" browser error (on the server computer or remotely)
    • sudo ufw allow 8787 #reopen the 8787 port for the RStudio Server
    • If that doesn't work, check your server computer's internet access.
    • Check the RStudio Server link from the server computer itself (through a browser)
      • http://[your server IP address]:8787
      • http://192.168.0.100:8787 (example pattern)
    • Check that you can ssh into the server
  • Check status of the ssh service (on the server computer's terminal)
    • systemctl status ssh.service #check if it's active
    • systemctl restart ssh.service #restart if you're having issues
    • sudo service ssh restart #try restarting another way
    • sudo ufw status numbered #check which ports are open
      • sudo ufw allow <your ssh port> #reopen the ssh port if needed
  • Check that the server computer has internet access
    • sudo lshw -class network #shows network details
    • ping google.com -c2
      • Wait for results from the 2 packets. If the ping statistics say 0% packet loss, then you have internet working properly.
    • ping 8.8.8.8 -c2
      • Wait for results from the 2 packets. If the ping statistics say 0% packet loss, then you are connected to internet even if the DNS isn't working
      • If 100% packet loss, then you're not connected to internet (not a DNS problem)
    • If either ping fails and says "Temporary failure in name resolution" then the DNS is not routing internet traffic correctly.
    • Turn off the internet router for 30 seconds, then back on. This can fix several problems including router issues that affect every device, as well as IP assignment problems that don't affect server internet but prevent remote access through ssh or the RStudio browser url.
    • Reboot the computer.
    • Connect to ethernet and, if you get internet back, then download & install updates.
    • If you have tried everything and nothing works, wait 1 day to see if the problem fixes itself. If not, you may need to reinstall the server.
  • Check Linux kernel currently loaded. The kernel is the skeleton beneath your Ubuntu system. It is important for basic things like loading Ubuntu on startup and hardware compatibility.
    • uname -a
    • If you buy new hardware (e.g. wifi adapter), check that it is compatible with your Linux kernel.
  • Check Linux kernels available to you. [More info
    • dpkg --list | grep linux-image
    • That's two hypens before list
    • It's good to have a few old versions in case an update causes startup problems. You can power down the computer, then power it on and hold the F2 key to bring up the GRUB boot loader. If you can boot using an older kernel, you might be able to resolve problems with the new kernel without reinstalling your whole system.
  • Search available software by keywords, for example:
    • sudo apt search "video editor"
    • This will output a list of all software you have with this function
  • Stress test your RAM annually with memtester, per advice from Genome Spot 
  • 2/8/2022 issue with "initramfs" noted after a routine apt update and apt upgrade. Rebooting stopped with this error: "[end Kernel panic -  not syncing: VFS: unable to mount fs on unknown block c(0,0)]"
    • Solved on Ubuntu server 20.04.03 LTS using the following commands (adapted from here). I didn't need to mount any partitions beforehand because I was not using a live CD. I accessed the GRUB boot loader (screenshot examples) and booted using an older kernel (5.4.0-97-lowlatency), then used the terminal to fix the newer kernel's initramfs:
      • sudo update-initramfs -u -k 5.4.0-99-lowlatency
        • Change the underlined part to suit your needs
        • The underlined part was my newest Linux kernel that failed to load. That kernel was listed a few lines above the original "Kernel panic" error message. If you missed that information, identify your newest kernel using: 
          dpkg --list | grep linux-image
        • Your newest Linux kernel name may be different from mine!
      • sudo update-grub
      • sudo reboot
  • If login screen from the GUI doesn't work, how to access the terminal
    • Ctrl + Alt + F1 keys will bring up the terminal
  • Turn off the computer from the terminal, then reboot:
    • sudo shutdown -r now
  • Turn off the computer from the terminal, without reboot:
    • sudo shutdown -P now  # first method
    • sudo poweroff  #alternative

Good luck!

  • The key to success is following instructions, trial and error, checking for typos, and using the internet to find solutions for problems you'll encounter along the way
  • Patience is more important than being an expert Linux user or programmer
  • Break it up into a few days and stop to celebrate each completed step
  • You can do this as a beginner! It seems intimidating, but it's not that bad
  • If the Linux installation keeps failing, try an older version (e.g. Ubuntu 20 or Ubuntu 22)

If you get stuck after a terminal command, use Ctrl+Z or Ctrl+C

  • This is like the "Esc" key for Linux
  • Ctrl+Z or Ctrl+C will exit you out of any other shells (the Python shell, the R shell) or file editing (vim, nano) that you might find yourself stuck in
  • Ctrl+Z stops processes and brings you back to the main terminal
  • Typing exit or quit and pressing [ENTER] may also work

This post is based on my original post for installing Ubuntu server 20.04 LTS (published December 20, 2020), but I copy/paste and edit the notes as a new post whenever I make major updates.

Last edited 1/6/2026.

No comments:

Post a Comment

Setting up Ubuntu 24.04.x LTS desktop and server, RStudio server, and JypyterLab at home

Why?  Set up a Linux server computer on a home network if: You want to run code that takes a long time to complete. Let it run on the server...