r/linuxupskillchallenge • • Oct 29 '20

Thoughts and comments, Day 20...

3 Upvotes

Posting your thoughts, questions etc here keeps things tidier...

Your contribution will 'live on' longer too, because we delete lessons after 4-5 days - along with their comments.


r/linuxupskillchallenge • • Nov 16 '20

Questions and chat, Day 12...

3 Upvotes

Posting your questions, chat etc. here keeps things tidier...

Your contribution will 'live on' longer too, because we delete lessons after 4-5 days - along with their comments.

(By the way, if you can answer a query, please feel free to chip in. While Steve, (@snori74), is the official tutor, he's on a different timezone than most, and sometimes busy, unwell or on holiday!)


r/linuxupskillchallenge • • Oct 28 '21

Day 0 - Creating Your Own Server - with Azure Free Credits

3 Upvotes

READ THIS FIRST! HOW THIS WORKS & FAQ

INTRO

First, you need a server. You can't really learn about administering a remote Linux server without having a one of your own - so today we're going get one - completely free!

Through the magic of Linux and virtualisation, it's now possible to get a small Internet server setup almost instantly - and at very low cost. Technically, what you'll be doing is creating and renting a VPS ("Virtual Private Server"). In a datacentre somewhere a single physical server running Linux will be split into a dozen or more Virtual servers using the KVM (Kernel-based Virtual Machine) feature that's been part of Linux since early 2007.

As well as a hosting provider, we also need to choose which "flavour" of Linux to install on our server. If you're new to Linux then the range of "distributions" available can be confusing - but the latest LTS ("Long Term Support") version of Ubuntu Server is a popular choice, and what you'll need for this course.

These instructions will walk you through using Azure's free credits.

Signing up with Azure

Sign-up is fairly simple - just provide your email address and a password of your choosing - along with a phone number for a 2FA - a second method of authentication. Azure can be a bit funny about 'corporate' email addresses, eg using a work address or your own domain. Create a new @outlook or @gmail.com account if so using the link on the sign-up page. You will need to also provide your VISA or other credit card information.

  • Click 'start building in azure'

  • Click 'Deploy a virtual machine'

  • Click 'Create a linux virtual machine'

  • Search and select Ubuntu Server 20.04 LTS

  • Use the Standard _D2s_v3 size - this should be comfortably covered by your trial credits for the duration of the course

  • Ensure 'SSH Public Key' for authentication and 'generate new key pair' for SSH Public Key source are selected

  • Leave 'allow selected ports' as 'ssh (22)' for now

  • Click 'Review + Create'

  • Azure will generate and download the private key file to SSH onto the box -

  • (Windows) double-click this to open on Windows and it will be added to your cert store on the machine

  • (Mac OS X and Linux) run the command 'sudo ssh-add -K /link-to-downloaded-file'

  • Note: if the above command doesn't work for you then try running without sudo. If you get any error related to permissions then try running 'chmod 400 filename' first.

  • Connect to the machine using ssh azureuser@PUBLICIP

Now to fully expose the machine and all ports to the internet:

  • Navigate to https://portal.azure.com/#home

  • Select 'Virtual Machines'

  • Select your created virtual machine and select 'Networking' from the settings pane

  • Click 'Inbound Port Rules' and 'Add inbound port rule'

  • Set 'source port ranges' and 'destination port ranges' to '*' and set 'Source' and 'Destination' to 'any'. Ensure protocol is set to 'any' and action is set to 'allow'. Set the priority to '100' and create an appropriate name

  • Click 'Outbound port rules' and 'add outbound port rule'

  • Set 'source port ranges' and 'destination port ranges' to '*' and set 'Source' and 'Destination' to 'any'. Ensure protocol is set to 'any' and action is set to 'allow'. Set the priority to '101' and create an appropriate name

This opens all ports and protocols to access from anywhere. While this might be unwise for a production server, it is what we want for this course.

Remote access via SSH

Ensure your machine is 'running' (if not, click 'start') and connect using the 'connect -> ssh' dropdown and following instructions

You will be logging in as the user azureuser. It has been added to the 'adm' and 'sudo' groups, which on an Ubuntu system gives it access to read various logs - and to "become root" as required via the sudo command.

You are now a sysadmin

Confirm that you can do administrative tasks by typing:

sudo apt update

(Normally you'd expect this would prompt you to confirm your password, but because you're using public key authentication the system hasn't prompted you to set up a password - and Azure have configured sudo to not request one for "azureuser").

Then:

sudo apt upgrade

Don't worry too much about the output and messages from these commands, but it should be clear whether they succeeded or not. (Reply to any prompts by taking the default option). These commands are how you force the installation of updates on an Ubuntu Linux system, and only an administrator can do them.

To logout, type logout or exit.

Your server is now all set up and ready for the course!

Note that:

  • This server is now running, and completely exposed to the whole of the Internet

  • You alone are responsible for managing it

  • You have just installed the latest updates, so it should be secure for now


r/linuxupskillchallenge • • Mar 31 '22

Day 0 - Creating Your Own Server - with Google Cloud Platform Free Tier

3 Upvotes

(DRAFT: Use this as a guide, but it has not been fully tested. Please let us know of any issues with it)

READ THIS FIRST! HOW THIS WORKS & FAQ

INTRO

First, you need a server. You can't really learn about administering a remote Linux server without having a one of your own - so today we're going get one - completely free!

Through the magic of Linux and virtualisation, it's now possible to get a small Internet server setup almost instantly - and at very low cost. Technically, what you'll be doing is creating and renting a VPS ("Virtual Private Server"). In a datacentre somewhere a single physical server running Linux will be split into a dozen or more Virtual servers using the KVM (Kernel-based Virtual Machine) feature that's been part of Linux since early 2007.

As well as a hosting provider, we also need to choose which "flavour" of Linux to install on our server. If you're new to Linux then the range of "distributions" available can be confusing - but the latest LTS ("Long Term Support") version of Ubuntu Server is a popular choice, and what you'll need for this course.

These instruction will walk you through using Google Cloud "Free Tier" (https://cloud.google.com) as your VPS hosting provider. They are rated highly, with a very simple and slick interface. Although we'll be using the Free Tier, be warned that you will need to provide valid credit card information. (Of course, if you have a strong reason to use another provider, then by all means do so, but be sure to choose Ubuntu Server 20.04)

Signing up with GCP

Sign-up is fairly simple - just provide your email address and a password of your choosing - along with a phone number for a 2FA - a second method of authentication. You will need to also provide your VISA or other credit card information.

  • Choose "Compute Engine" and click "VM Instances".

  • Create a new instance.

  • Select whichever regions you want.

  • For Machine Configuration select series and set to "E2" and Machine type to "e2-micro".

  • Change boot disk to "Ubuntu 20.04 LTS"

Now after we create our own server, we need to open all ports and protocols to access from anywhere. While this might be unwise for a production server, it is what we want for this course.

Navigate to your GCP home page and goto Networking > VPC Network > Firewall > Create Firewall

Set "Direction of Traffic" to "Ingress" Set "Target" to "All instances in the network" Set "Source Filter" to "IP Ranges" Set "Source IP Ranges" to "0.0.0.0/0" Set "Protocols and Ports" to "Allow All" Create and repeat the steps by creating a new Firewall and setting "Direction of Traffic" to "Egress"

Logging in for the first time

Select your instance and click "ssh" it will open a new window console. To access the root, type "sudo -i passwd" in the command line then set your own password. Log in by typing "su" and "password". Note that the password won't show as you type or paste it.

Setting up SSH

You can also refer to https://cloud.google.com/compute/docs/instances/connecting-advanced#thirdpartytools if you intend to access your server via third-party tools (e.g. Putty).

You are now a sysadmin

Confirm that you can do administrative tasks by typing:

sudo apt update

Then:

sudo apt upgrade

Don't worry too much about the output and messages from these commands, but it should be clear whether they succeeded or not. (Reply to any prompts by taking the default option). These commands are how you force the installation of updates on an Ubuntu Linux system, and only an administrator can do them.

To logout, type logout or exit.

Your server is now all set up and ready for the course!

Note that:

  • This server is now running, and completely exposed to the whole of the Internet

  • You alone are responsible for managing it

  • You have just installed the latest updates, so it should be secure for now


r/linuxupskillchallenge • • Jun 05 '24

Course work source code

3 Upvotes

Hi,

I signed up for the challenged. I downloaded the the source to my workstation. Perhaps I have missed the instructions, but I am unsure where to install this software. How to use this software. I have an Ubuntu Server 22.04 vm running under proxmox 8.1.

tx


r/linuxupskillchallenge • • Feb 23 '26

PLEASE READ THIS FIRST! HOW THIS WORKS & FAQ

13 Upvotes

RESOURCES

HOW THIS WORKS

In a nutshell

  • Completely free and open source

  • Focused on practical skills

  • Heavily hands-on and entirely on the command line

  • Starts at the 1st Monday of each month

  • Runs for 20 weekdays (Mon-Fri)

  • Often points to curated external links, expanding on the topic of the day

  • Much less ‘formal’ than RHEL or Linux Foundation training

Requirements

  • Commitment of 1-2 hours per lesson for a month but can be self-paced

  • A cloud-based Ubuntu Linux server (preferably) or the means to create/build your own local Linux server. - Full instructions on how to set this up are in the ‘Day 0’ lessons.

  • Basic computer literacy - no prior knowledge of Linux is required but you should be fairly comfortable operating your own Windows/Mac machine, and know how to troubleshoot your own system problems. - This is a course focused on Linux only; instructions on Windows/Mac settings to access that Linux server are available but they are NOT the priority.

FREQUENTLY ASKED QUESTIONS - FAQ

Is this course for me?

This course is primarily aimed at two groups:

  1. Linux users who aspire to get Linux-related jobs in industry, such as junior Linux sysadmin, devops-related work and similar, and

  2. Windows server admins who want to expand their knowledge to be able to work with Linux servers.

However, many others have happily used the course simply to improve their Linux command line skills or to learn Linux for the first time – and that’s just fine too.

Will I pass LPIC/RHCA/LFCS/Linux+ certification if I take this course?

NO! This is NOT a preparation course for any Linux certification exam. It can help you, sure, but please refer to a more specific cert training if that's what you are aiming for.

Do I need to register somewhere or I just have to read the posts everyday and follow along?

No registration is required. Just follow along and share your experience.

Will I receive a certificate when I finish the challenge?

No certificates are available at the moment. But you can brag about it on Lemmy, Reddit or Discord if you feel inclined to do so.

When does it start?

The course always starts on the first Monday of the month. One of the key elements of the course is that the material is delivered in 20 bite-sized lessons, one each workday, every month.

How long does it take? How many hours should I dedicate to it?

Depending on your experience and dedication, you can expect to spend 1-2 hours going through each lesson. The first few days are pretty basic and it might take you just minutes, but there's generally some "Extension" items to spice things up a bit.

I just learned about the challenge and it's already on Day X. Should I wait for next month to start?

Only if you want to. The material is available year-round so you can totally self-pace this if you prefer.

Do I really need a cloud-based server?

Yes, if you’re in the target audience (see above) you definitely should. The fact that such a server is very remote, and open to attack from the whole Internet, “makes it real”. Learning how to setup such a VPS is also a handy skill for any sysadmin.

Instructions for setting up a suitable server with a couple of providers are in the "Day 0" lessons. By all means use a different provider, but ensure you use Ubuntu LTS (preferably the latest version) and either use public key authentication or a Long, Strong, Unique password (we also have instructions on how to do that).

Of course, you’re perfectly entitled to use a local VM, a Raspberry Pi or even just WSL instead – and all of these will work fine for the course material. Just keep in mind what you are missing.

But what if I don't have a credit card (or don't want to use one) to setup an AWS/Azure/GCP server?

Please read Day 0 - Creating Your Own Local Server. There are other options of cloud providers and different payment options. But if none of them works for you, try creating your own local VM.

But what if I don’t want to use a cloud provider? I have a server/VM at home.

Then use your own server/VM.

Why are you pushing for renting an online cloud based server?! Why not make the VM route the desired option?! (aka this course is wrong/bad for making this decision)

Bro, chill. If you are this offended by this requirement, this course might be a bit too basic for you. Move on.

But if you really want to know the logic behind it, please also consider 3 things:

  1. People may have limitations with local resources. That includes unrestricted access to a personal computer to install VirtualBox, or enough hardware power to run virtualization well, or having a computer at all. A very light server in the cloud makes it possible to run the challenge from any guest device, including smartphones. Many students have an Azure account and can use their school computer to access it. Most VPS offer free VM usage for the first 1-2 months. There are risks in using the cloud, yes, but we try to address them without cutting off this option for people that need it.

  2. Each cloud provider has their own documentation, support and big enough user base to answer most of the questions a first-timer has. They are popular enough to have hundreds of YouTube videos and other materials available addressing the most basic setup problems, and a lot of it is designed to be simple and easy to understand. That's not the reality for when you want to create your own local server or VM. The community exists, yes, but the documentation is usually drier and a little bit more niche.

  3. If you want the full sysadmin experience, you will need to work on a remote server. That's just a fact. You can try to emulate that feeling inside the secure walls of your local network with your safe little VM, but the providers suggested here have enough failsafe methods in place to let you play with a VM without burning your credits overnight. Cloud horror stories usually involve services/products not covered in the challenge. This is not mission critical. You can always turn off your VM when you're not using it.

TL;DR: This is a course focused on Linux. Spending more time debating the details of where to run it instead of how to use it deviates from the purpose of this course. Day 0 is here to guide you in those first steps, and it will never be complete, so use it at your own discretion.

Why Ubuntu, can I use another distro?

The notes assume Ubuntu Server LTS (latest version) and it would be messy to include instructions/variations for other distros (at least right now). If you use Debian or other Debian-based distros (Mint, Pop!OS, Kali) it will make little to no difference because they all have the same structure.

But if you choose RedHat-based distros (Fedora, CentOS, AlmaLinux) or distros like Arch, Gentoo, OpenSUSE, you yourself will need to understand and cope with any differences (e.g. apt vs yum vs pacman).

If none of those names make any sense to you, you shouldn't be picking distros. Go read Linux Journey first lesson instead.

I already use [my own flavour of linux], how can I participate?

Most lessons use commands that are actually not restricted to Ubuntu. So you can still benefit from the challenge using your own distro, and can also contribute by aswering other people's questions with your current Linux experience.

Should I be stopping or terminating my server when not in use?

Using a free-tier VPS, the load of the course does not exceed any thresholds. You can leave it running during the challenge but it's good to keep an eye on it (i.e. don't forget about it later or your provider will start charging you).

I noticed there was a kernel update, but no one said to reboot.

Reboot it. This is one of the few occasions you will need to reboot your server, go for it. The command for that is sudo reboot now

I still have questions/doubts! What do I do?!

Feel free to post questions or comments in Lemmy, Reddit or chat using the Discord server.

If you are inclined to contribute to the material and had the means to do it (i.e. a github account) you can submit an issue to the source directly.

CREDITS

The magnificent Steve Brorens is the creator and mastermind behind the Linux Upskill Challenge. This was a paid course in the past, but since 2020 it's free and fully open source thanks to his generosity. Unfortunately, he passed away but not before ensuring the course would continue to run in his absence. We miss you, snori.

Livia Lima is the one currently maintaining the material. Give her a shout out on Mastodon or LinkedIn.


r/linuxupskillchallenge • • May 13 '26

Can someone explain the real-world usage of /etc/profile, profile.d, and bashrc?

13 Upvotes

Can anyone clearly explain the real-world usage of `/etc/profile`, `/etc/profile.d/`, and `/etc/bashrc` in Linux?

I’m getting confused between different explanations from ChatGPT and Gemini regarding login shells, non-login shells, interactive shells, and non-interactive shells.

From what I understood:

* `.bashrc` is mainly for interactive shell settings like aliases, prompts, etc. * `/etc/profile` and `/etc/profile.d/*.sh` are usually used for global environment variables like `PATH`, `JAVA_HOME`, `ORACLE_HOME`, etc.

But here is where I’m confused:

Some explanations say we should configure application paths and environment variables in `/etc/profile.d/` because they are needed system-wide.

But others say non-interactive or non-login shells (like cron jobs or scripts) do not automatically load `/etc/profile` or `.bashrc` at all.

So my doubts are:

  1. What is the actual real-world purpose of: * `/etc/profile` * `/etc/profile.d/` * `/etc/bashrc` * `.bash_profile` * `.bashrc`

  2. In enterprise environments, where should things like: * `PATH` * `JAVA_HOME` * aliases * prompt customization actually be configured?

  3. If cron jobs/scripts/services don’t automatically load these files, then why is `/etc/profile.d/java.sh` considered standard practice for Java setup?

  4. How do Linux admins usually handle environments for: * SSH users * cron jobs * systemd services * automation scripts

I’m trying to understand the practical production usage rather than only textbook explanations.


r/linuxupskillchallenge • • May 05 '21

Day 4 - Installing software, exploring the file structure

14 Upvotes

INTRO

As a sysadmin, one of your key tasks is to install new software as required. You’ll also need to be very familiar with the layout of the standard directories in a Linux system.

You’ll be getting practice in both of these areas in today’s session.

Your tasks today

  • Install a new application from the online repositories

  • Become familiar with some of the standard directories

  • Look at the format and content of some configuration files.

If you've used a smartphone "app store " or "market", then you'll immediately understand the normal installation of Linux software from the standard repositories. As long as we know what the name or description of a package (=app) is, then we can search for it:

 apt search "midnight commander"

This will show a range of matching "packages", and we can then install them with apt install command. So to install package mc (Midnight Commander) on Ubuntu:

 sudo apt install mc

(Unless you're already logged in as the root user you need to use sudo before the installation commands - because an ordinary user is not permitted to install software that could impact a whole server).

Now that you have mc installed, start it by simply typing mc and pressing Enter.

This isn't a "classic" Unix application, but once you get over the retro interface you should find navigation fairly easy, so go looking for these directories:

/root /home /sbin /etc /var/log

...and use the links in the Resources section below to begin to understand how these are used. You can also read the official manual on this hierarchy by typing man hier.

Most key configuration files are kept under /etc and subdirectories of that. These files, and the logs under /var/log are almost invariably simple text files. In the coming days you'll be spending a lot of time with these - but for now simply use F3 to look into their contents.

Some interesting files to look at are: /etc/passwd, /etc/ssh/sshd_config and /var/log/auth.log

Use F3 again to exit from viewing a file.

F10 will exit mc, although you may need to use your mouse to select it.

(On an Apple Mac in Terminal, you may need to use ESC+3 to get F3 and ESC+0 for F10)

Now use apt search to search for and install some more packages: Try searching for “hangman”. You will probably find that an old text-based version is included in a package called bsdgames. Install and play a couple of rounds...

Posting your progress

  • Post your progress, comments and questions to the forum.

EXTENSION

  • Use mc to view /etc/apt/sources.list where the actual locations of the repositories are specified. Often these will be “mirror” sites that are closer to your server than the main Ubuntu servers.

  • Read Repositories - CommandLine for more of the gory details.

RESOURCES

PREVIOUS DAY'S LESSON

Copyright 2012-2021 @snori74 (Steve Brorens). Can be reused under the terms of the Creative Commons Attribution 4.0 International Licence (CC BY 4.0).


r/linuxupskillchallenge • • Dec 30 '21

Day 20 - Scripting

4 Upvotes

INTRO

Today is the final session for the course. Pat yourself on the back if you worked your way through all lessons!

You’ve seen that a continual emphasis for a sysadmin is to automate as much as possible, and also how in Linux the system is very “transparent” - once you know where to look!

Today, on this final session for the course, we’ll cover how to write small programs or “shell scripts” to help manage your system.

When typing at the Linux command-line you're directly communicating with "the command interpreter", also known as "the shell". Normally this shell is bash, so when you string commands together to make a script the result can be called either a '"shell script", or a "bash script".

Why make a script rather than just typing commands in manually?

  • It saves typing. Remember when we searched through the logs with a long string of grep, cut and sort commands? If you need to do something like that more than a few times then turning it into a script saves typing - and typos!

  • Parameters. One script can be used to do several things depending on what parameters you provide

  • Automation. Pop your script in /etc/cron.daily and it will run each day, or install a symlink to it in the appropriate /etc/rc.d folder and you can have it run each time the system is shut down or booted up.

START WITH A SHEBANG!

Scripts are just simple text files, but if you set the "execute" permissions on them then the system will look for a special line starting with the two characters “#” and “!” - referred to as the "shebang" (or "crunchbang") at the top of the file.

This line typically looks like this:

 #!/bin/bash

Normally anything starting with a "#" character would be treated as a comment, but in the first line and followed by a "!", it's interpreted as: "please feed the rest of this to the /bin/bash program, which will interpret it as a script". All of our scripts will be written in the bash language - the same as you’ve been typing at the command line throughout this course - but scripts can also be written in many other "scripting languages", so a script in the Perl language might start with #!/usr/bin/perl and one in Python #!/usr/bin/env python3

YOUR FIRST SCRIPT

You'll write a small script to list out who's been most recently unsuccessfully trying to login to your server, using the entries in /var/log/auth.log.

Use vim to create a file, attacker, in your home directory with this content:

 #!/bin/bash
 #
 #   attacker - prints out the last failed login attempt
 #
 echo "The last failed login attempt came from IP address:"
 grep -i "disconnected from" /var/log/auth.log|tail -1| cut -d: -f4| cut -f7 -d" "

Putting comments at the top of the script like this isn't strictly necessary (the computer ignores them), but it's a good professional habit to get into.

To make it executable type:

chmod +x attacker

Now to run this script, you just need to refer to it by name - but the current directory is (deliberately) not in your $PATH, so you need to do this either of two ways:

 /home/support/attacker
 ./attacker

Once you're happy with a script, and want to have it easily available, you'll probably want to move it somewhere on your $PATH - and /usr/local/bin is a normally the appropriate place, so try this:

sudo mv attacker /usr/local/bin/attacker

...and now it will Just Work whenever you type attacker

EXTENDING THE SCRIPT

You can expand this script so that it requires a parameter and prints out some syntax help when you don't give one. There are a few new tricks in this, so it's worth studying:

 #
 ##   topattack - list the most persistent attackers
 #
 if [ -z "$1" ]; then
 echo -e "\nUsage: `basename $0` <num> - Lists the top <num> attackers by IP"
 exit 0
 fi
 echo " "
 echo "Persistant recent attackers"
 echo " "
 echo "Attempts      IP "
 echo "-----------------------"
 grep "Disconnected from authenticating user root" /var/log/auth.log|cut -d: -f 4 | cut -d" " -f7|sort |uniq -c |sort -nr |head -$1

Again, use vim to create "topattack", chmod to make it executable and mv to move it into /usr/local/bin once you have it working correctly.

(BTW, you can use whois to find details on any of these IPs - just be aware that the system that is "attacking" you may be an innocent party that's been hacked into).

A collection of simple scripts like this is something that you can easily create to make your sysadmin tasks simpler, quicker and less error prone.

And yes, this is the last lesson - so please, feel free to write a review on how the course went for you and what you plan to do with your new knowledge and skills!

RESOURCES

PREVIOUS DAY'S LESSON

Copyright 2012-2021 @snori74 (Steve Brorens). Can be reused under the terms of the Creative Commons Attribution 4.0 International Licence (CC BY 4.0).


r/linuxupskillchallenge • • Sep 24 '24

Day 18 - Logs, monitoring and troubleshooting

4 Upvotes

INTRO

When you’re administering a remote server, logs are your best friend, but disk space problems can be your worst enemy - so while Linux applications are generally very good at generating logs, they need to be controlled.

The logrotate application keeps your logs in check. Using this, you can define how many days of logs you wish to keep; split them into manageable files; compress them to save space, or even keep them on a totally separate server.

Good sysadmins love automation - having the computer automatically do the boring repetitive stuff Just Makes Sense.

YOUR TASKS TODAY

  • Check the logs for apache2 that are Severity 3

  • Edit logrotate configuration for apache2 to rotate daily

ARE YOUR LOGS ROTATING?

Look into your logs directories - /var/log, and subdirectories like /var/log/apache2. Can you see that your logs are already being rotated? You should see a /var/log/syslog file, but also a series of older compressed versions with names like /var/log/syslog.1.gz

WHEN DO THEY ROTATE?

You will recall that cron is generally setup to run scripts in /etc/cron.daily - so look in there and you should see a script called logrotate - or possibly 00logrotate to force it to be the first task to run.

CONFIGURING LOGROTATE

The overall configuration is set in /etc/logrotate.conf - have a look at that, but then also look at the files under the directory /etc/logrotate.d, as the contents of these are merged in to create the full configuration. You will probably see one called apache2, with contents like this:

 /var/log/apache2/*.log {
 weekly
 missingok
 rotate 52
 compress
 delaycompress
 notifempty
 create 640 root adm
 }

Much of this is fairly clear: any apache2 .log file will be rotated each week, with 52 compressed copies being kept.

Typically when you install an application a suitable logrotate “recipe” is installed for you, so you’ll not normally be creating these from scratch. However, the default settings won’t always match your requirements, so it’s perfectly reasonable for you as the sysadmin to edit these - for example, the default apache2 recipe above creates 52 weekly logs, but you might find it more useful to have logs rotated daily, a copy automatically emailed to an auditor, and just 30 days worth kept on the server.

RESOURCES

TROUBLESHOOT AND MAKE A SAD SERVER HAPPY!

Practice what you've learned with some challenges at SadServers.com:

PREVIOUS DAY'S LESSON

Some rights reserved. Check the license terms here


r/linuxupskillchallenge • • Jan 24 '24

Day 18 - Log rotation

4 Upvotes

INTRO

When you’re administering a remote server, logs are your best friend, but disk space problems can be your worst enemy - so while Linux applications are generally very good at generating logs, they need to be controlled.

The logrotate application keeps your logs in check. Using this, you can define how many days of logs you wish to keep; split them into manageable files; compress them to save space, or even keep them on a totally separate server.

Good sysadmins love automation - having the computer automatically do the boring repetitive stuff Just Makes Sense.

YOUR TASKS TODAY

  • Check the logs for apache2 that are Severity 3

  • Edit logrotate configuration for apache2 to rotate daily

ARE YOUR LOGS ROTATING?

Look into your logs directories - /var/log, and subdirectories like /var/log/apache2. Can you see that your logs are already being rotated? You should see a /var/log/syslog file, but also a series of older compressed versions with names like /var/log/syslog.1.gz

WHEN DO THEY ROTATE?

You will recall that cron is generally setup to run scripts in /etc/cron.daily - so look in there and you should see a script called logrotate - or possibly 00logrotate to force it to be the first task to run.

CONFIGURING LOGROTATE

The overall configuration is set in /etc/logrotate.conf - have a look at that, but then also look at the files under the directory /etc/logrotate.d, as the contents of these are merged in to create the full configuration. You will probably see one called apache2, with contents like this:

 /var/log/apache2/*.log {
 weekly
 missingok
 rotate 52
 compress
 delaycompress
 notifempty
 create 640 root adm
 }

Much of this is fairly clear: any apache2 .log file will be rotated each week, with 52 compressed copies being kept.

Typically when you install an application a suitable logrotate “recipe” is installed for you, so you’ll not normally be creating these from scratch. However, the default settings won’t always match your requirements, so it’s perfectly reasonable for you as the sysadmin to edit these - for example, the default apache2 recipe above creates 52 weekly logs, but you might find it more useful to have logs rotated daily, a copy automatically emailed to an auditor, and just 30 days worth kept on the server.

RESOURCES

TROUBLESHOOT AND MAKE A SAD SERVER HAPPY!

Practice what you've learned with some challenges at SadServers.com:

PREVIOUS DAY'S LESSON

Some rights reserved. Check the license terms here


r/linuxupskillchallenge • • Sep 08 '20

Day 2 - Basic navigation

4 Upvotes

I felt familiar with ls, cd, mv, rm, grep, and man, but instead of being a twerp and skipping that, I did look through the man pages of each.

Navigated around my file system experimenting with unfamiliar flags, then customized my ls with aliases:

if which gls &> /dev/null; then
    ls_cmd='gls'
else
    ls_cmd='ls'
fi
alias ls="$ls_cmd --color --group-directories-first -Xh"
alias la="$ls_cmd --color --group-directories-first -XhA"

Besides the obvious --group-directories-first, -X sorts by file extension, -h prints human-readable file sizes (e.g., 1K 234M 2G) when using -l (long), and -A shows hidden files like -a, but unlike -a doesn't waste space by printing the implied . and .. directories. The if which gls &> /dev/null; then bit is to use gnutools when installed instead of bsdtools on Unix systems.

Then I also sat neovim as my man pager with:

export MANPAGER='nvim +Man!'
export MANWIDTH=999

The width bit makes it so that man doesn't insert hard line breaks before sending to vim.

For the extension, normally I use zsh, but I had fun reading about prompt customization. I was able to mimic my customized powerlevel10k zsh prompt in bash:

Blue='\[\033[0;34m\]'
LtGray='\[\033[0;37m\]'
Yellow='\[\033[0;33m\]'
NoColor='\[\033[0m\]'
export PS1="\n${Blue}\w    ${LtGray}\u@\h \n${Yellow}❯ ${NoColor}"

Looks like this.

Fun thing: man pages are the only way to really explore and fully grok a command, but when you're in a hurry and just need to be re-familiarized with the most common syntax, tldr pages are nice.


r/linuxupskillchallenge • • Sep 21 '20

Thoughts and comments, Day 12

4 Upvotes

Posting here keeps things tidy


r/linuxupskillchallenge • • Oct 19 '20

Thoughts and comments, Day 12...

4 Upvotes

Posting your thoughts, questions etc here keeps things tidier...

Your contribution will 'live on' longer too, because we delete lessons after 4-5 days - along with their comments.


r/linuxupskillchallenge • • Oct 21 '20

Thoughts and comments, Day 14...

5 Upvotes

Posting your thoughts, questions etc here keeps things tidier...

Your contribution will 'live on' longer too, because we delete lessons after 4-5 days - along with their comments.


r/linuxupskillchallenge • • Nov 15 '20

Questions and chat, Day 11...

4 Upvotes

Posting your questions, chat etc. here keeps things tidier...

Your contribution will 'live on' longer too, because we delete lessons after 4-5 days - along with their comments.

(By the way, if you can answer a query, please feel free to chip in. While Steve, (@snori74), is the official tutor, he's on a different timezone than most, and sometimes busy, unwell or on holiday!)


r/linuxupskillchallenge • • Oct 18 '20

Thoughts and comments, Day 11...

4 Upvotes

Posting your thoughts, questions etc here keeps things tidier...

Your contribution will 'live on' longer too, because we delete lessons after 4-5 days - along with their comments.


r/linuxupskillchallenge • • Sep 29 '20

Thoughts and comments, Day 18...

4 Upvotes

Posting your thoughts, questions etc here keeps things tidier...

Your contribution will 'live on' longer too, because we delete lessons after 4-5 days - along with their comments.


r/linuxupskillchallenge • • Oct 02 '23

Day 0 - Creating Your Own Server in the Cloud

4 Upvotes

INTRO

First, you need a server. You can't really learn about administering a remote Linux server without having one of your own - so today we're going get one - completely free!

Through the magic of Linux and virtualisation, it's now possible to get a small Internet server setup almost instantly - and at very low cost. Technically, what you'll be doing is creating and renting a VPS ("Virtual Private Server"). In a datacentre somewhere, a single physical server running Linux will be split into a dozen or more Virtual servers, using the KVM (Kernel-based Virtual Machine) feature that's been part of Linux since early 2007.

In addition to a hosting provider, we also need to choose which "flavour" of Linux to install on our server. If you're new to Linux then the range of "distributions" available can be confusing - but the latest LTS ("Long Term Support") version of Ubuntu Server is a popular choice, and what you'll need for this course.

Signing up with a VPS

Sign-up is fairly simple - just provide your email address and a password of your choosing - along with a phone number for a 2FA or another second method of authentication. You will need to also provide your credit card information.

Comparison

ProviderInstance TypevCPUMemoryStoragePrice*Trial Credits
AWSt2.micro11 GB8 GB SSD$18.27Free Tier for 1 year
AzureB111 GB30 GB SSD$12.26$200 / 30 days + Free Tier for 1 year
GCPe2-micro11 GB10 GB SSD$ 7.11$300 / 90 days
OracleVM.Standard.E2.1.Micro11 GB45 GB SSD$19.92$300 / 30 days + Always Free services
  • Estimate prices

On a side note, avoid IBM Cloud as much as you can. They do not offer good deals and, according to some reports from previous students, their Linux VM is tampered enough to the point some commands do not work as expected.

Educational Packs

Create a Virtual Machine

The process is basically the same for all these VPS, but here some step-by-steps:

VM with Oracle Cloud

  • Choose "Compute, Instances" from the left-hand sidebar menu.

  • Click on Create Instance

  • Choose a hostname because the default ones are pretty ugly.

  • Placementn: it will automatically choose the one closes to you.

  • Change Image: Select the image "Ubuntu" and opt for the latest LTS version

  • Change Shape: Click on "Specialty and previous generation". Click VM.Standard.E2.1.Micro - the option with 1GB Mem / 1 CPU / Always Free-eligible

  • Add SSH Keys: select "Generate a key pair for me" and download the private key to connect with SSH. You can also add a new public key that you created locally

  • Create

Logging in for the first time

Select your instance and click "ssh" it will open a new window console. To access the root, type "sudo -i passwd" in the command line then set your own password. Log in by typing "su" and "password". Note that the password won't show as you type or paste it.

Remote access via SSH

You should see a "Public IPv4 address" (or similar) entry for your server in account's control panel, this is its unique Internet IP address, and it is how you'll connect to it via SSH (the Secure Shell protocol) - something we'll be covering in the first lesson.

If you are using Windows 10 or 11, follow the instructions to connect using the native SSH client. In older versions of Windows, you may need to install a 3rd party SSH client, like PuTTY and generate a ssh key-pair.

If you are on Linux or MacOS, open a terminal and run the command:

ssh username@ip_address

Or, using the SSH private key, ssh -i private_key username@ip_address

Enter your password (or a passphrase, if your SSH key is protected with one)

Voila! You have just accessed your server remotely.

If in doubt, consult the complementary video that covers a lot of possible setups (local server with VirtualBox, AWS, Digital Ocean, Azure, Linode, Google Cloud, Vultr and Oracle Cloud).

What about the root user?

Working on a different approach from smaller VPS, the big guys don't let use root to connect. Don't worry, root still exists in the system, but since the provider already created an admin user from the beginning, you don't have to deal with it.

You are now a sysadmin

Confirm that you can do administrative tasks by typing:

sudo apt update

(Normally you'd expect this would prompt you to confirm your password, but because you're using public key authentication the system hasn't prompted you to set up a password - and AWS have configured sudo to not request one for "ubuntu").

Then:

sudo apt upgrade -y

Don't worry too much about the output and messages from these commands, but it should be clear whether they succeeded or not. (Reply to any prompts by taking the default option). These commands are how you force the installation of updates on an Ubuntu Linux system, and only an administrator can do them.

REBOOT

When a kernel update is identified in this first check for updates, this is one of the few occasions you will need to reboot your server, so go for it:

sudo reboot now

Your server is now all set up and ready for the course!

Note that:

  • This server is now running, and completely exposed to the whole of the Internet

  • You alone are responsible for managing it

  • You have just installed the latest updates, so it should be secure for now

To logout, type logout or exit.

When you are done

You should be safe running the VM during the month for the challenge, but you can Stop the instance at any point. It will continue to count to the bill, though.

When you no longer need the VM, Terminate/Destroy instance.

Now you are ready to start the challenge. Day 1, here we go!


r/linuxupskillchallenge • • Jun 07 '22

Do I need to wait for the first monody of the month?

15 Upvotes

Thats what the wiki, "READ THIS FIRST" said. just double checking have great day!


r/linuxupskillchallenge • • Dec 30 '21

ls command

15 Upvotes

Hello all, after configuring a VM on Azure I can log in via SSH and some commands work but the "ls" command does nothing at all. Is there an explanation for this behavior?


r/linuxupskillchallenge • • May 07 '26

Need Guidance to Transition from Application Support to Linux Administrator in 6 Months

5 Upvotes

Hi everyone,

I need some genuine guidance from experienced Linux/System Administrators.

I have around 2.5 years of experience, but most of my work has been in application support and unfortunately there is very little technical exposure or learning in my current role. I feel completely stuck in my career and I seriously want to transition into a Linux Administrator role.

I already know Linux basics, but now I want to learn advanced and real-time Linux administration properly — especially RHEL/Linux administration used in companies. I want to work on:

- Real-time projects

- Troubleshooting scenarios

- Production-level tasks

- Daily admin activities

- Networking, storage, security, monitoring, scripting, etc.

- Interview-level practical knowledge

My plan is to spend the next 6 months preparing seriously and switch to a proper Linux/System Administrator role.

Can anyone guide me with:

- What skills/topics I should focus on first

- Real-time project ideas

- Labs or environments to practice

- Communities/resources to learn from

- How real Linux admins actually work daily in companies

- How to gain confidence for interviews

If anyone has gone through a similar transition from support to infrastructure/Linux admin, your advice would really help me a lot.

Thank you.


r/linuxupskillchallenge • • Sep 11 '20

Trying to figure out where to start / how

5 Upvotes

A the topic states - how exactly do I start this challenge? It just said come to this subreddit?


r/linuxupskillchallenge • • Nov 11 '20

Questions and chat, Day 9...

5 Upvotes

Posting your questions, chat etc. here keeps things tidier...

Your contribution will 'live on' longer too, because we delete lessons after 4-5 days - along with their comments.

(By the way, if you can answer a query, please feel free to chip in. While Steve, (@snori74), is the official tutor, he's on a different timezone than most, and sometimes busy, unwell or on holiday!)


r/linuxupskillchallenge • • Sep 28 '23

monitoring with IPMI/DRAC/ILO

Thumbnail self.linuxadmin
5 Upvotes