Ubuntu Server 20.04 on a Raspberry PI 4B

Chat about Linux in general
Forum rules
Do not post support questions here. Before you post read the forum rules. Topics in this forum are automatically closed 6 months after creation.
Locked
rpmckinley
Level 3
Level 3
Posts: 129
Joined: Sun Jul 20, 2014 9:33 pm
Location: Texas

Ubuntu Server 20.04 on a Raspberry PI 4B

Post by rpmckinley »

10/15/2021. Raspberry PI-4B Ubuntu server.

Due to the simplicity and the difficulty of building this Ubuntu Server I thought it would be appropriate to start a new thread so that maybe I can help others who attempt to do a similar project.
The Raspberry PI-4B computer is incredibly small for what it is . It’s amazing how they have packed so much onto such a small footprint. This machine has 4GB ram, 128GB storage capacity. Will display 2 HDMI monitors, and has an Ethernet connection.
Assembly should take less than an hour if purchased as a kit.
That is the simply part.
The difficulty come in when you try to follow the instructions on how to deal with those Micro-SD cards.

I’ve spent three days working on building this machine and the system. The difficulties have all been centered around getting these micro-sd cards formatted and the operating systems installed on them. And there was absolutely no need for it. It should have all been simple and easy. Hopefully I can help others avoid the same pitfalls that I went through.

The Raspberry computer runs on the smallest of these cards, and will not boot from the larger sd-cards that run in a USB slot. (There are many online instructions on how to do this but they all failed.)
The cards are as follows;
Smallest card; MicroSDXC UHS-I, 128 GB. Fits in the card reader slot on the computer.
Larger cards; SDHC UHS-I, 32 GB. Fits on a USB adapter.

Raspberrypi.org provides an image installer. That program is designed to provide an “easy” way to install the operating system onto the SD card. However in my case the program only runs on MS-Windows. I could not get it to work on Linux Mint 19.3.
Rather than fight with that program I suggest you use the Linux application to create a start up disk.
The Linux Start up disk is part of the Linux Mint system. And it does the same job of installing the operating image onto the SD cards.

What you will need:
A USB card reader that will hold the MicroSDXC UHS-I Card. If you purchase the cards with the adapter then you can use almost any USB card reader.
A second USB thumb drive or another USB card reader.
Download the Ubuntu Server from the Ubuntu web site. Unzip the files into a separate folder or directory.
Use the Linux Create startup Disk program to install the Ubuntu ISO image onto the larger SD card.
(SDHC UHS-1) or a USB thumb drive.
That will create a boot-able Server startup disk.
Reboot your computer and boot up on the Ubuntu Server from the thumb drive or sd-card.
This is your Server install disk. Use this to install the Server onto the other smaller MicroSDXC card.
Install the Ubuntu Server program onto the MicroSDXC sd card and insert it into the Raspberry PI-4B card slot. When you boot the Raspberry PI 4B it should boot as a Ubuntu Server.
If you are doing this from a Microsoft Windows computer the process should be the same. Just use the Raspberry image install program.

At this point I have the Raspberry computer up and operating on the Raspberry Operating system. But I am unable to get it to boot up on the USB cards. It’s running on the Micro-SDXC in the card reader slot. I will install the Server onto a separate MicroSDXC card.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
rpmckinley
Level 3
Level 3
Posts: 129
Joined: Sun Jul 20, 2014 9:33 pm
Location: Texas

Re: Ubuntu Server 20.04 on a Raspberry PI 4B

Post by rpmckinley »

Status REPORT ON Raspberry Ubuntu Server
11/04/2021;
Building A Raspberry pi 4b Ubuntu server is both complicated, difficult and simple and easy at the same time. The most difficult part is finding the correct and accurate information on all the different components, both hardware and software.

Here is what I have at the time of this report;
Raspberry pi 4B computer. 4 GB ram, and a 128 GB SD-Card as the drive.
Raspberry Ubuntu server vs 20.4.3.
Software components include Raspberry version of Ubuntu Server, Mysql, VSFTPD file transfer protocol.
The system is accessible from my home intranet but still not accessible from the world-wide-web.

Assembling the Raspberry PI 4B is simple if purchased as a kit. Assembly took less than one hour.
The most difficult part of creating a working computer is to get the SD-Card formatted as a bookable drive.
The Raspberry PI 4B can NOT boot from a USB drive.
The only way to get the sd-Card to work is to use the Raspberry image burner provided by Raspberry. Only the MS-Windows version of this works.
First format the drive as a boot-able card using the Raspberry image installer.
Then ‘burn’ the Ubuntu installer image to a second USB thumb drive. Boot a desktop pc on the thumb drive and ‘install’ the Ubuntu operating system onto the SD-Card formatted in the previous step. Be sure not to erase the boot partition during the installation.

Other applications installed include Mysql, PHP, Vsftpd, Filezilla, and my own html index.html files.
Working with these applications is the most difficult part. The processes to install and run these applications is actually very simple and easy, it’s finding the CORRECT information that is difficult. There are hundreds of web pages that profess to give instructions on every application. But most of them only reiterate what is written by the software developers. They never really tell you how to actually do what is required and how to do it.
If you’re working from a pc terminal connected through an ssh connection the process is simple and easy. First open a terminal on your pc. Type ssh your-user-name, and the server ip address you want to access. Ie, (ssh myname@192.168.0.25))

Installing applications;
(Mysql),
sudo apt-get update
sudo apt-get install mysql-server
sudo mysql_secure_installation utility
https://docs.rackspace.com/support/how- ... ng-system/

This utility prompts you to define the mysql root password and other security-related options, including removing remote access to the root user and setting the root password.

sudo ufw enable
sudo ufw allow mysql

To set Mysql to automatically install on a system reboot use the following;
sudo systemctl enable mysql
The command to start Mysql is easy, once it is up and running.
sudo systemctl start mysql
userbin/mysql -u root -p
The -p assumes you have set a password to user root.
Ubuntu typically does not apply a password to user root, you can set a password if you wish, but not from here.
The command without the password is simply Mysql -u root.
Now you can figure out how to work with Mysql from the actual Mysql resource pages.
https://www.mysql.com/
As I said the most difficult part of building a home based Ubuntu server is finding accurate information. There are hundreds of web pages out there that intend to give instructions for every piece and application available, but most of them don’t ever really tell us what actually works. They all give general instructions on what the developers want people to do – do-this, do-that, do-this, and then push this> but nothing really works.
I still have not found the absolute command syntax to set user rights and folder rights. The commands are CHMOD and CHOWN.
And the format is
Here’s an example of a bunch of junk that does NOT work.
https://www.howtogeek.com/437958/how-to ... -on-linux/
It’s all good information but nothing actually works.
As I said earlier, I still have not found the precise syntax for what I need to do.
Problem; I want to grant access to the world of the Index.html and related files in the var/www/html folder. Access should be +R (read) +X (Execute) -W (Minus write). In other words the world must NOT be allowed to edit or write to these files. However the owners and administrators must have all rights to the folder and all the files. (+r+w+x). Sounds very simple, but so far nothing I have found actually works properly.
3. Chmod syntax
The syntax of chmod is:
$ chmod {users}{operator}{permission} {filename}
Operators let you specify the permissions. 
https://linuxapt.com/blog/453-chmod-com ... untu-linux
rpmckinley
Level 3
Level 3
Posts: 129
Joined: Sun Jul 20, 2014 9:33 pm
Location: Texas

Re: Ubuntu Server 20.04 on a Raspberry PI 4B

Post by rpmckinley »

I still do not have this server on-line and open to the WW-Web.. I have a domain name But have not registered a DNS at this point.
I want to make sure the server is stable with all applications running properly before I register a DNS.
rpmckinley
Level 3
Level 3
Posts: 129
Joined: Sun Jul 20, 2014 9:33 pm
Location: Texas

Re: Ubuntu Server 20.04 on a Raspberry PI 4B

Post by rpmckinley »

Does anyone know the actual syntax for changing the user and owner rights to files and folders?
I have tried 30+ ways of using CHMOD to change the rights to the index.html in /var/www/html folder.
Those are obviously the index.html pages presented to anyone who can see this server from the internet, (so far no one can see it).
The file and folder rights are being denied to the FTP and can not load new files.
Read, write and execute should be granted to administrators only.
All others get -w,,,,,,,, NO WRITE capabilities., and no rights to modify or change files from out side world.
Petermint
Level 9
Level 9
Posts: 2981
Joined: Tue Feb 16, 2016 3:12 am

Re: Ubuntu Server 20.04 on a Raspberry PI 4B

Post by Petermint »

I use the Raspberry Pi OS for everything you mention. There is no need to use Ubuntu or any server distribution.

If you download the image to Linux Mint, you just right click the image file and write it to the microSD card. MicroSD cards are available up to 1 TB. FOr server use, you should get one with speed A1 or A2. Sandisk says their Extreme Pro range will last a ling time. For non 24 hour server use, all the major brands wirk for a couple of years.

There are instructions for adding a USB SSD and booting from the USB SSD. I used those successfully once and choose to leave the boot on a small microSD card then put all the files on an SSD. The Pi 4 can run two USB 3 SSDs at full speed.

Many of the database and Web servers place files in weird places, making it difficult to use an SSD. I found it easy to direct MariaDB and Nginx into a separate directory for all data and work files. The directory can then be on an SSD partition.

In your example, you mention /var/www/html. You could set up a www partition on the SSD and point /var/www to the partition. To make things even easier in Nginx, you can redirect to /home/pi/web. I do that and run the Web sites as the user separate from root. Apache was slightly trickier when I last used Apache. MariaDB has some equivalent I used years ago.

For problems with chmod, run the ls -l command in the directory and one level higher to see what is actually set. Sometimes you have to follow all the permissions down from / to find a blockage. The various software packages also have strange interpretations and some have special settings for permissions. Myy recent experience is with Samba, not FTP.
Locked

Return to “Chat about Linux”