This is the multi-page printable view of this section. Click here to print.
Fedora
- 1: Installation & Setup
- 2: Configuration & Customization
- 2.1: Accessibility Options in Fedora Linux
- 2.2: Application Defaults and Associations in Fedora Linux
- 2.3: Application Launcher Customization on Fedora Linux
- 2.4: Desktop Environment Customization in Fedora Linux
- 2.5: Display Settings and Multi-Monitor Setup in Fedora Linux
- 2.6: Fedora Linux System Theme Customization Tutorial
- 2.7: Fedora Linux: Keyboard Layout and Shortcuts
- 2.8: Fedora Linux: Notification Settings Tutorial
- 2.9: Fedora Linux: Panel and Taskbar Configuration
- 2.10: File Manager Configuration in Fedora Linux
- 2.11: Power Management Configuration in Fedora Linux
- 2.12: Shell Customization (Bash/Zsh) in Fedora Linux
- 2.13: System Font Configuration in Fedora Linux
- 2.14: Wallpaper and Screensaver Configuration
- 2.15: Window Manager Tweaks on Fedora Linux
- 3: Package Management
- 4: System Administration
- 4.1: Automating Tasks with Cron
- 4.2: Firewall Configuration
- 4.3: Kernel Management
- 4.4: Managing System Services
- 4.5: Network Configuration
- 4.6: Package Management
- 4.7: Remote Access and SSH
- 4.8: System Backup and Restore
- 4.9: System Logging and Log Analysis
- 4.10: System Monitoring with systemd
- 4.11: System Performance Tuning
- 4.12: System Security Best Practices
- 4.13: System Updates and Patch Management
- 4.14: User Management
- 4.15: Virtualization with KVM
- 5: Networking & Security
- 6: Development & Programming
- 7: Multimedia & Entertainment
- 8: Productivity Tools
1 - Installation & Setup
2 - Configuration & Customization
2.1 - Accessibility Options in Fedora Linux
Visual Accessibility
High Contrast Theme
Fedora offers a high contrast theme that enhances visibility by increasing the contrast between text and background colors. This feature is particularly helpful for users with low vision or certain visual impairments.
To enable the high contrast theme:
- Click on the “Activities” overview button (the top-left icon on the desktop).
- Search for and open the “Settings” application.
- Navigate to the “Universal Access” section.
- Under the “Vision” tab, toggle the “High Contrast” option to enable it.
Screen Reader
Fedora includes Orca, a powerful screen reader that provides spoken and braille feedback to users with visual impairments. Orca can read aloud the contents of the screen, including text, menus, and dialogues.
To enable the screen reader:
- Open the “Settings” application.
- Navigate to the “Universal Access” section.
- Under the “Vision” tab, toggle the “Screen Reader” option to enable Orca.
- You can further customize Orca’s settings by clicking on the “Settings” button next to the “Screen Reader” option.
Text-to-Speech
Fedora offers text-to-speech (TTS) capabilities, which can read aloud text from documents, web pages, or other applications. This feature is particularly useful for users with visual impairments or reading difficulties.
To enable text-to-speech:
- Open the “Settings” application.
- Navigate to the “Universal Access” section.
- Under the “Speech” tab, toggle the “Text-to-Speech” option to enable it.
- You can configure various settings, such as the voice, rate, and pitch, by clicking on the “Settings” button next to the “Text-to-Speech” option.
Zoom
Fedora provides a zoom feature that allows users to magnify the entire screen or a specific area. This can be beneficial for users with low vision or those who require a larger on-screen display.
To enable the zoom feature:
- Open the “Settings” application.
- Navigate to the “Universal Access” section.
- Under the “Vision” tab, toggle the “Zoom” option to enable it.
- You can customize the zoom settings, such as the magnification level and zoom behavior, by clicking on the “Settings” button next to the “Zoom” option.
Auditory Accessibility
Visual Alerts
Fedora offers visual alerts as an alternative to auditory alerts for users with hearing impairments. This feature provides visual cues, such as flashing the screen or displaying a notification, instead of playing sound alerts.
To enable visual alerts:
- Open the “Settings” application.
- Navigate to the “Universal Access” section.
- Under the “Hearing” tab, toggle the “Visual Alerts” option to enable it.
Closed Captions
Fedora supports closed captions for multimedia content, which displays text transcriptions of audio or dialogue. This feature is particularly useful for users with hearing impairments or those who prefer to follow along with on-screen text.
To enable closed captions:
- Open the multimedia application (e.g., Videos, Web Browser, etc.).
- Look for the closed caption or subtitle settings within the application’s preferences or playback controls.
- Enable closed captions and select the desired language or style.
Mobility Accessibility
Keyboard Navigation
Fedora provides robust keyboard navigation capabilities, allowing users to control the desktop environment and applications using keyboard shortcuts and commands. This feature is beneficial for users with mobility impairments or those who prefer to minimize mouse usage.
To enable keyboard navigation:
- Open the “Settings” application.
- Navigate to the “Universal Access” section.
- Under the “Typing” tab, toggle the “Keyboard Navigation” option to enable it.
- You can further customize keyboard navigation settings, such as key repeat rate and delay, by clicking on the “Settings” button next to the “Keyboard Navigation” option.
Sticky Keys
The sticky keys feature allows users to press modifier keys (e.g., Ctrl, Alt, Shift) and other keys separately, rather than simultaneously. This can be helpful for users with mobility impairments or those who find it difficult to press multiple keys at once.
To enable sticky keys:
- Open the “Settings” application.
- Navigate to the “Universal Access” section.
- Under the “Typing” tab, toggle the “Sticky Keys” option to enable it.
Mouse Keys
Fedora’s mouse keys feature allows users to control the mouse pointer using the numeric keypad on the keyboard. This can be beneficial for users who have difficulty using a physical mouse or trackpad.
To enable mouse keys:
- Open the “Settings” application.
- Navigate to the “Universal Access” section.
- Under the “Pointing & Clicking” tab, toggle the “Mouse Keys” option to enable it.
- You can further customize mouse keys settings, such as the pointer speed and acceleration, by clicking on the “Settings” button next to the “Mouse Keys” option.
Additional Resources
Fedora provides additional resources and documentation to help users explore and utilize accessibility features effectively:
- Fedora Documentation: https://docs.fedoraproject.org/en-US/quick-docs/getting-started-with-accessibility/
- Orca Screen Reader Documentation: https://help.gnome.org/users/orca/stable/
- GNOME Accessibility Documentation: https://wiki.gnome.org/Projects/GTK/Accessibility
Remember, accessibility features can be combined and customized to suit individual needs and preferences. Fedora’s commitment to accessibility empowers users with disabilities or special needs to have an inclusive and enriching computing experience.
2.2 - Application Defaults and Associations in Fedora Linux
Understanding File Types, Protocols, and MIME Types
Before we dive into the details, let’s briefly explain the key terms:
File Types: These refer to the extensions associated with files, such as
.txt
for text files,.pdf
for PDF documents, or.mp3
for audio files. File types help the operating system identify the appropriate application to handle a particular file.Protocols: Protocols define the way data is transmitted over a network. Common examples include
http
for web browsing,mailto
for email clients, andftp
for file transfers.MIME Types: MIME (Multipurpose Internet Mail Extensions) types are a standardized way of identifying file formats on the internet. They are used by web servers and browsers to determine how to handle different types of content. For example,
text/plain
is a MIME type for plain text files, andimage/jpeg
is for JPEG images.
Graphical Method: Using the Default Applications Tool
Fedora provides a graphical tool called “Default Applications” that allows you to manage application associations easily. Here’s how to use it:
Open the “Activities” overview by clicking on the “Activities” icon in the top-left corner of your desktop or by pressing the
Super
(Windows) key.Search for “Default Applications” and click on the corresponding entry.
The “Default Applications” window will open, displaying various categories such as “Web,” “Mail,” “Calendar,” “Music,” “Video,” “Photos,” “Terminal,” and “Text Editor.”
Click on a category to see the currently associated applications for that category.
To change the default application, click on the desired application from the list or click the “Other…” button to browse for an alternative application.
Once you’ve made your selections, click the “Set as Default” button to apply the changes.
This graphical tool provides a user-friendly way to manage application associations for common file types and protocols. However, it may not cover all possible associations, especially for more obscure file types or protocols.
Command-Line Method: Using the xdg-mime
and xdg-open
Commands
For more advanced or specific associations, you can use the command-line utilities xdg-mime
and xdg-open
. These utilities are part of the Freedesktop.org standards and provide a consistent way to manage application associations across different desktop environments.
Listing Current Associations
To list the current associations for a specific file type or MIME type, use the xdg-mime
command with the query
subcommand:
xdg-mime query default <file_extension>
For example, to check the default application for opening PDF files:
xdg-mime query default application/pdf
This command will display the currently associated application for the specified file type or MIME type.
Setting New Associations
To set a new association for a file type or MIME type, use the xdg-mime
command with the default
subcommand:
xdg-mime default <desktop_file> <mime_type>
Replace <desktop_file>
with the path to the .desktop
file of the application you want to associate with the specified <mime_type>
.
For example, to set the Evince document viewer as the default application for opening PDF files:
xdg-mime default /usr/share/applications/evince.desktop application/pdf
Note that you may need to run this command with sudo
if you want to set system-wide associations.
Opening Files with a Specific Application
If you want to open a file with a specific application without changing the default association, you can use the xdg-open
command:
xdg-open <file_path> --app <desktop_file>
Replace <file_path>
with the path to the file you want to open, and <desktop_file>
with the path to the .desktop
file of the application you want to use.
For example, to open a PDF file with the Okular document viewer:
xdg-open /path/to/document.pdf --app /usr/share/applications/org.kde.okular.desktop
Resetting Associations to Default
If you want to reset the associations for a specific file type or MIME type to their default values, use the xdg-mime
command with the default
subcommand and the --mode
option:
xdg-mime default <mime_type> --mode user
Replace <mime_type>
with the MIME type you want to reset.
For example, to reset the associations for PDF files to their default values:
xdg-mime default application/pdf --mode user
This command will restore the default application associations for the specified MIME type for the current user.
Managing Associations with Other Tools
While the graphical tool and command-line utilities mentioned above are the primary methods for managing application associations in Fedora, you can also use other tools depending on your desktop environment or preference.
For example, in the GNOME desktop environment, you can use the dconf-editor
tool to modify application associations through the org.gnome.desktop.applications
schema.
In the KDE Plasma desktop environment, you can use the “File Associations” tool to manage associations for different file types and MIME types.
Additionally, some applications may provide their own settings or preferences to associate file types with themselves.
Conclusion
Managing application defaults and associations in Fedora Linux can greatly enhance your productivity and streamline your workflow. By understanding the concepts of file types, protocols, and MIME types, and using the appropriate tools, you can ensure that your system opens the right applications for the corresponding files or protocols.
Whether you prefer the graphical approach or the command-line utilities, this tutorial has provided you with the necessary knowledge and steps to take control of your application associations in Fedora Linux.
Remember, the freedom to choose and customize is one of the core principles of the Linux ecosystem, and managing application associations is an essential aspect of that freedom.
2.3 - Application Launcher Customization on Fedora Linux
GNOME Application Launcher Customization
GNOME is the default desktop environment for Fedora Workstation. The application launcher in GNOME is known as the “Activities Overview.” Follow these steps to customize it:
1. Rearranging Application Icons
- Open the Activities Overview by pressing the
Super
key (Windows key) or clicking the “Activities” icon in the top-left corner of the screen. - Right-click on an application icon and select “Move to Favorites” to add it to the dock at the left side of the screen.
- To remove an application from the dock, right-click on its icon and select “Remove from Favorites.”
- You can rearrange the order of the icons in the dock by holding the
Super
key and dragging the icons to their desired positions.
2. Creating Custom Application Launchers
You can create custom application launchers for applications, scripts, or commands that are not present in the default list.
- Open the
~/Desktop
directory in your file manager. - Right-click in the directory and select “Create New” -> “Desktop Entry.”
- In the new file, add the following content, replacing the placeholders with your desired values:
[Desktop Entry]
Type=Application
Name=Custom Application Name
Comment=A brief description of the application
Exec=/path/to/executable
Icon=/path/to/icon.png
Terminal=false
Categories=Utility;
- Save the file with a
.desktop
extension (e.g.,custom-app.desktop
). - The custom application launcher should now appear in the Activities Overview.
3. Keyboard Shortcuts
GNOME allows you to set custom keyboard shortcuts for launching applications or performing specific actions.
- Open the “Settings” application.
- Navigate to “Keyboard” -> “Keyboard Shortcuts” -> “View and Customize Shortcuts.”
- Scroll down to the “Custom Shortcuts” section and click the “+” button to add a new shortcut.
- Enter a descriptive name for the shortcut and the command to be executed (e.g.,
/path/to/application
). - Click the “Set Shortcut” button and press the desired key combination.
- The new shortcut will be listed in the “Custom Shortcuts” section.
KDE Plasma Application Launcher Customization
KDE Plasma is another popular desktop environment available on Fedora. The application launcher in KDE Plasma is known as the “Application Launcher” or “Kickoff.”
1. Rearranging Application Icons
- Open the Application Launcher by clicking the “K” icon in the bottom-left corner of the screen or by pressing the
Super
key. - Right-click on an application icon and select “Add to Favorites” to add it to the favorite applications list.
- To remove an application from the favorites list, right-click on its icon and select “Remove from Favorites.”
- You can rearrange the order of the icons in the favorites list by holding the
Super
key and dragging the icons to their desired positions.
2. Creating Custom Application Launchers
Similar to GNOME, you can create custom application launchers for applications, scripts, or commands that are not present in the default list.
- Open the
~/.local/share/applications
directory in your file manager. - Right-click in the directory and select “Create New” -> “Text File.”
- In the new file, add the following content, replacing the placeholders with your desired values:
[Desktop Entry]
Type=Application
Name=Custom Application Name
Comment=A brief description of the application
Exec=/path/to/executable
Icon=/path/to/icon.png
Terminal=false
Categories=Utility;
- Save the file with a
.desktop
extension (e.g.,custom-app.desktop
). - The custom application launcher should now appear in the Application Launcher.
3. Keyboard Shortcuts
KDE Plasma also allows you to set custom keyboard shortcuts for launching applications or performing specific actions.
- Open the “System Settings” application.
- Navigate to “Shortcuts” -> “Custom Shortcuts.”
- Click the “Edit” button next to “Custom Shortcuts.”
- Click the “New” button to create a new custom shortcut.
- Enter a descriptive name for the shortcut and the command to be executed (e.g.,
/path/to/application
). - Click the “None” button next to “Shortcut” and press the desired key combination.
- Click “OK” to save the new shortcut.
Additional Tips
- You can create categories or folders in the application launcher to better organize your applications. Right-click in an empty space and select “Create New” -> “Folder.”
- Consider using keyboard shortcuts for frequently used applications to improve your productivity.
- Customize the appearance of the application launcher by changing themes or icon sets in your desktop environment’s settings.
- Regularly review and remove unused application launchers to keep your launcher organized and clutter-free.
Customizing your application launcher can greatly enhance your desktop experience and workflow efficiency. By following the steps outlined in this tutorial, you can tailor the application launcher to suit your specific needs and preferences on Fedora Linux.
2.4 - Desktop Environment Customization in Fedora Linux
GNOME
GNOME is the default desktop environment in Fedora Workstation. It’s a modern, sleek, and user-friendly DE with a focus on simplicity and efficiency.
Customizing GNOME Shell
GNOME Shell is the core user interface of the GNOME desktop environment. You can customize various aspects of GNOME Shell, including the top bar, activities overview, and more.
Tweaking GNOME Shell Appearance
- Install the
gnome-tweaks
package:sudo dnf install gnome-tweaks
- Launch GNOME Tweaks from the application menu or by running
gnome-tweaks
in the terminal. - Under the “Appearance” section, you can change the GTK theme, icon theme, cursor theme, and more.
- Install the
Configuring GNOME Shell Extensions
- GNOME Shell Extensions provide additional functionality and customization options.
- Visit the GNOME Shell Extensions website to browse and install various extensions.
- Popular extensions include Dash to Dock, User Themes, and Clipboard Indicator.
Adjusting GNOME Shell Settings
- Open the Settings application from the application menu or by running
gnome-control-center
in the terminal. - Navigate through various sections to customize desktop backgrounds, display settings, keyboard shortcuts, and more.
- Open the Settings application from the application menu or by running
Customizing GNOME Applications
GNOME applications, such as Files (Nautilus), Text Editor (gedit), and Image Viewer (Eye of GNOME), can also be customized to suit your needs.
Customizing Nautilus (Files)
- Open Nautilus and go to
Edit > Preferences
. - Customize view options, behavior, previews, and more.
- Install Nautilus extensions like
nautilus-python
to add extra functionality.
- Open Nautilus and go to
Customizing gedit (Text Editor)
- Open gedit and go to
Edit > Preferences
. - Customize font, color scheme, plugins, and more.
- Open gedit and go to
Customizing Eye of GNOME (Image Viewer)
- Open Eye of GNOME and go to
Edit > Preferences
. - Customize background color, zoom options, and more.
- Open Eye of GNOME and go to
KDE Plasma
KDE Plasma is a highly customizable and feature-rich desktop environment that offers a wide range of options for personalization.
Customizing KDE Plasma Desktop
Changing Desktop Theme
- Right-click on the desktop and select “Look and Feel” or go to
System Settings > Desktop Behavior > Workspace
. - Choose from various desktop themes or create your own.
- Right-click on the desktop and select “Look and Feel” or go to
Configuring Plasma Widgets
- Right-click on the desktop and select “Add Widgets” or go to
System Settings > Desktop Behavior > Desktop Effects
. - Add various widgets like weather, notes, and system monitors to your desktop.
- Right-click on the desktop and select “Add Widgets” or go to
Adjusting Plasma Settings
- Go to
System Settings
and explore various categories like “Appearance”, “Workspace”, “Shortcuts”, and “Notifications” to customize Plasma to your liking.
- Go to
Customizing KDE Applications
KDE applications, such as Dolphin (File Manager), Kate (Text Editor), and Gwenview (Image Viewer), can also be customized.
Customizing Dolphin (File Manager)
- Open Dolphin and go to
Control > Configure Dolphin
. - Customize view modes, file previews, and more.
- Open Dolphin and go to
Customizing Kate (Text Editor)
- Open Kate and go to
Settings > Configure Kate
. - Customize font, color scheme, plugins, and more.
- Open Kate and go to
Customizing Gwenview (Image Viewer)
- Open Gwenview and go to
Settings > Configure Gwenview
. - Customize background color, zoom options, and more.
- Open Gwenview and go to
Xfce
Xfce is a lightweight and fast desktop environment that offers a good balance between simplicity and customization options.
Customizing Xfce Desktop
Changing Desktop Theme
- Go to
Applications > Settings > Appearance
or runxfce4-appearance-settings
. - Choose from various styles, icon themes, and more.
- Go to
Configuring Xfce Panels
- Right-click on the panel and select “Panel > Panel Preferences” or run
xfce4-panel --preferences
. - Customize panel layout, add or remove items, and more.
- Right-click on the panel and select “Panel > Panel Preferences” or run
Adjusting Xfce Settings
- Go to
Applications > Settings
or runxfce4-settings-manager
. - Explore various categories like “Desktop”, “Window Manager”, and “Keyboard” to customize Xfce.
- Go to
Customizing Xfce Applications
Xfce applications, such as Thunar (File Manager), mousepad (Text Editor), and Ristretto (Image Viewer), can also be customized.
Customizing Thunar (File Manager)
- Open Thunar and go to
Edit > Preferences
. - Customize view options, behavior, and more.
- Open Thunar and go to
Customizing mousepad (Text Editor)
- Open mousepad and go to
Edit > Preferences
. - Customize font, color scheme, and more.
- Open mousepad and go to
Customizing Ristretto (Image Viewer)
- Open Ristretto and go to
Edit > Preferences
. - Customize background color, zoom options, and more.
- Open Ristretto and go to
MATE
MATE is a desktop environment that follows the traditional GNOME 2 style, offering a familiar and customizable experience.
Customizing MATE Desktop
Changing Desktop Theme
- Go to
System > Preferences > Look and Feel
or runmate-appearance-properties
. - Choose from various themes, icon themes, and more.
- Go to
Configuring MATE Panels
- Right-click on the panel and select “Properties” or run
mate-panel --preferences
. - Customize panel layout, add or remove items, and more.
- Right-click on the panel and select “Properties” or run
Adjusting MATE Settings
- Go to
System > Preferences
or runmate-control-center
. - Explore various categories like “Desktop”, “Window Manager”, and “Keyboard” to customize MATE.
- Go to
Customizing MATE Applications
MATE applications, such as Caja (File Manager), Pluma (Text Editor), and Eye of MATE (Image Viewer), can also be customized.
Customizing Caja (File Manager)
- Open Caja and go to
Edit > Preferences
. - Customize view options, behavior, and more.
- Open Caja and go to
Customizing Pluma (Text Editor)
- Open Pluma and go to
Edit > Preferences
. - Customize font, color scheme, and more.
- Open Pluma and go to
Customizing Eye of MATE (Image Viewer)
- Open Eye of MATE and go to
Edit > Preferences
. - Customize background color, zoom options, and more.
- Open Eye of MATE and go to
Advanced Customization
For more advanced customization, you can explore various tools and techniques, such as:
Editing Configuration Files
- Many desktop environments and applications use configuration files (often in XML or INI format) to store settings.
- Carefully modifying these files can provide deeper customization options, but be cautious as incorrect changes can lead to issues.
Using Command-Line Tools
- Command-line tools like
gsettings
(for GNOME),kwriteconfig
(for KDE), andxfconf-query
(for Xfce) allow you to modify settings directly from the terminal. - This method requires knowledge of the specific settings and their values.
- Command-line tools like
Creating Custom Themes
- Many desktop environments support custom themes, allowing you to modify the look and feel to your liking.
- Tools like
gtk3-engines
andqt5ct
can help you create and apply custom themes.
Installing Third-Party Extensions/Addons
- Look for third-party extensions, addons, or plugins that provide additional customization options for your desktop environment.
- These can be found on official repositories, project
2.5 - Display Settings and Multi-Monitor Setup in Fedora Linux
Accessing Display Settings
- Click on the “Activities” overview button at the top-left corner of your desktop.
- Type “Settings” in the search bar and open the “Settings” application.
- In the “Settings” window, click on the “Displays” option.
Adjusting Display Resolution
- In the “Displays” settings, you will see a list of available displays connected to your system.
- Click on the display you want to adjust.
- Under the “Resolution” dropdown menu, select your desired resolution.
- The display will automatically apply the new resolution.
Adjusting Display Scaling
Display scaling is useful when you have a high-resolution display or want to adjust the size of user interface elements.
- In the “Displays” settings, click on the display you want to adjust.
- Locate the “Scale” section and use the slider to increase or decrease the scaling factor.
- Higher scaling factors will make everything appear larger, while lower scaling factors will make things appear smaller.
Rotating the Display
If you need to rotate your display for a specific use case or physical orientation, follow these steps:
- In the “Displays” settings, click on the display you want to rotate.
- Click on the “Rotation” dropdown menu and select the desired rotation (Normal, 90°, 180°, 270°).
- The display will rotate accordingly.
Adjusting Refresh Rate
A higher refresh rate can provide a smoother visual experience, especially for gaming or video playback.
- In the “Displays” settings, click on the display you want to adjust.
- Under the “Refresh Rate” dropdown menu, select the desired refresh rate.
- Note that available refresh rates depend on your monitor’s capabilities and the maximum supported by your graphics hardware.
Multi-Monitor Setup
Fedora Linux supports multiple monitors out of the box, allowing you to extend or mirror your desktop across multiple displays.
Enabling Multiple Monitors
- Connect the additional monitors to your computer’s video output ports (HDMI, DisplayPort, VGA, etc.).
- Open the “Displays” settings as described earlier.
- The additional monitors should appear in the “Displays” list.
Extending the Desktop
Extending the desktop allows you to treat multiple monitors as a single, larger workspace.
- In the “Displays” settings, make sure both monitors are detected and listed.
- Click on the primary display (usually the one with the menu bar).
- Check the “Extend desktop to this display” option.
- Adjust the display layout by dragging and positioning the monitor icons according to your physical setup.
Mirroring the Desktop
Mirroring the desktop duplicates the same content across all connected displays.
- In the “Displays” settings, make sure both monitors are detected and listed.
- Click on the primary display.
- Check the “Mirror display” option.
- All connected displays will now show the same content.
Display Arrangement
If your multi-monitor setup doesn’t match the physical arrangement, you can rearrange the display layout.
- In the “Displays” settings, click and drag the monitor icons to match their physical positions.
- You can also use the “Join Displays” option to combine multiple displays into a single larger workspace.
Display Profiles
Fedora Linux allows you to save and load display configurations as profiles, making it easier to switch between different setups.
- In the “Displays” settings, configure your desired multi-monitor setup.
- Click on the “Save” button at the bottom of the window.
- Give your profile a name and click “Save” again.
- To load a saved profile, click on the profile name in the “Displays” settings.
By following this comprehensive tutorial, you should now be able to adjust display settings, configure multi-monitor setups, and optimize your workspace according to your preferences in Fedora Linux.
2.6 - Fedora Linux System Theme Customization Tutorial
Introduction
Fedora Linux ships with the GNOME desktop environment by default, which offers a modern and sleek user interface. However, you may want to personalize the look and feel of your desktop to suit your taste or increase productivity. Fortunately, GNOME provides various tools and utilities to customize the system theme, icons, fonts, and other visual elements.
Changing the System Theme
The system theme determines the overall appearance of the desktop, including the color scheme, window decorations, and UI elements. To change the system theme in Fedora Linux, follow these steps:
- Open the “Settings” application by clicking on the “Activities” overview and typing “Settings”.
- In the “Settings” window, navigate to “Appearance”.
- Under the “Themes” section, you’ll see the currently applied theme. Click on the drop-down menu to view available themes.
- Select the theme you want to apply, and the changes will take effect immediately.
Customizing Icons
Icons are an essential part of the desktop experience, representing various applications, files, and folders. You can change the icon theme in Fedora Linux to give your desktop a fresh look.
- Open the “Settings” application and navigate to “Appearance”.
- Under the “Icons” section, click on the drop-down menu to view available icon themes.
- Select the icon theme you prefer, and the changes will be applied instantly.
Modifying Fonts
Fonts play a crucial role in the readability and aesthetic appeal of your desktop. Fedora Linux provides a wide range of font options to choose from.
- Open the “Settings” application and navigate to “Fonts”.
- In the “Fonts” section, you can modify various font settings, such as the default font, document font, monospace font, and more.
- Click on the respective drop-down menus to select the desired fonts.
- You can also adjust the font hinting and anti-aliasing settings for better rendering.
Adjusting the Desktop Background
The desktop background is one of the most visible elements of your desktop environment. Fedora Linux offers a variety of background options, including solid colors, pictures, and even live wallpapers.
- Right-click on the desktop and select “Change Desktop Background”.
- In the “Background” window, you can choose from various options:
- “Pictures”: Select an image from your local files or the provided wallpapers.
- “Colors”: Pick a solid color or create a custom gradient.
- “Live Wallpapers” (if available): Choose an animated background.
- Once you’ve made your selection, click “Set Background” to apply the changes.
Customizing the Login Screen
The login screen is the first thing you see when you start your Fedora Linux system. You can customize the login screen to match your system’s theme or personal preferences.
- Open the “Settings” application and navigate to “Users”.
- Under the “Users” section, click on the “Unlock” button and enter your password to make changes.
- Click on the user account you want to customize.
- In the “Account Settings” window, navigate to the “User Account” tab.
- Under the “Account Icon” section, you can change the user account icon by clicking on the current icon and selecting a new one.
- Under the “Account Background” section, you can choose a custom background image for the login screen.
Installing Third-Party Themes
While Fedora Linux comes with a decent selection of themes and icons, you can further enhance your desktop’s appearance by installing third-party themes from various sources.
- Open the “Software” application (or your preferred package manager).
- Search for “gnome-shell-extensions” or “gnome-tweaks” and install the corresponding package.
- After installation, open the “Extensions” application (you can search for it in the “Activities” overview).
- Browse and install the desired extensions or themes from the available options.
- Some popular third-party theme sources include:
- Gnome-Look.org - A vast collection of GNOME themes, icons, and extensions.
- Pling.com - Another excellent source for GNOME-related customizations.
Using the Gnome Tweaks Tool
The Gnome Tweaks Tool is a powerful utility that provides advanced customization options for the GNOME desktop environment. It allows you to tweak various aspects of your desktop, including the appearance, behavior, and functionality.
- Install the “Gnome Tweaks” package from the Software application or your preferred package manager.
- Once installed, open the “Tweaks” application (you can search for it in the “Activities” overview).
- The Tweaks application is divided into several sections, each offering different customization options:
- “Appearance”: Customize the desktop theme, icons, cursors, and more.
- “Desktop”: Adjust desktop icons, font rendering, and other desktop-related settings.
- “Top Bar”: Customize the top bar (panel) appearance and behavior.
- “Windows”: Modify window behavior, such as focus mode, titlebar buttons, and more.
- “Extensions”: Enable or disable GNOME Shell extensions.
Explore the various options available in the Tweaks application and make adjustments to suit your preferences.
Restoring Default Settings
If you’ve made too many customizations and want to revert to the default system theme and settings, you can easily do so by following these steps:
- Open the “Settings” application and navigate to “Appearance”.
- Under the “Themes” section, click on the drop-down menu and select the default system theme (usually named “Adwaita”).
- Repeat the same process for the “Icons” section and select the default icon theme.
- Navigate to the “Fonts” section and reset the font settings to their defaults.
- Right-click on the desktop and select “Change Desktop Background”.
- In the “Background” window, click on the “Reset” button to restore the default desktop background.
With this comprehensive tutorial, you should now have a solid understanding of how to customize the system theme, icons, fonts, and other visual elements in Fedora Linux. Personalize your desktop environment to create a unique and visually appealing workspace that suits your style and preferences.
2.7 - Fedora Linux: Keyboard Layout and Shortcuts
Introduction to Keyboard Layouts
Keyboard layouts determine the arrangement of characters on your physical keyboard. Fedora Linux supports a wide range of keyboard layouts, allowing you to work comfortably in various languages and layouts. By default, Fedora uses the standard US English keyboard layout, but you can easily switch to different layouts based on your preferences or language requirements.
Changing the Keyboard Layout
To change the keyboard layout in Fedora Linux, follow these steps:
- Open the “Settings” application.
- Navigate to the “Region & Language” section.
- Click on the “Input Sources” tab.
- Click the “+” button at the bottom of the list to add a new keyboard layout.
- Search for the desired layout or language, and select it from the list.
- Once added, you can switch between different keyboard layouts using the keyboard shortcut
Super + Space
(whereSuper
is the Windows/Command key).
Alternatively, you can use the command line to list available keyboard layouts and set a new layout:
# List available keyboard layouts
localectl list-x11-keymap-layouts
# Set a new keyboard layout (e.g., French)
localectl set-x11-keymap fr
Creating Custom Keyboard Shortcuts
Fedora Linux provides a powerful tool called “Settings” that allows you to create and manage custom keyboard shortcuts for both system-wide and application-specific tasks. Let’s explore how to create and customize shortcuts in each category.
System-wide Keyboard Shortcuts
System-wide keyboard shortcuts are global shortcuts that work across all applications and desktop environments. To create or modify system-wide shortcuts, follow these steps:
- Open the “Settings” application.
- Navigate to the “Keyboard” section.
- Click on the “Keyboard Shortcuts” tab.
- Here, you’ll find a list of predefined shortcuts categorized by functionality (e.g., Windows, Workspaces, Media, etc.).
- To create a new shortcut, scroll down to the bottom of the list and click the “+” button.
- In the “New Shortcut” dialog, enter a name for the shortcut and the command to be executed.
- Click the “Disabled” button to set the desired keyboard shortcut combination.
- Once you’ve set the shortcut, click “Add” to save the new shortcut.
Application-specific Keyboard Shortcuts
Many applications in Fedora Linux also support their own set of keyboard shortcuts, which can be customized within the application’s settings or preferences. The process for creating or modifying application-specific shortcuts may vary depending on the application, but generally, you can follow these steps:
- Open the application you want to customize shortcuts for.
- Look for the “Preferences” or “Settings” menu within the application.
- Navigate to the “Keyboard Shortcuts” or a similarly named section.
- Here, you should see a list of existing shortcuts for various actions within the application.
- To create a new shortcut, look for an option to add or customize shortcuts (e.g., a “+” button or “Customize” option).
- Follow the application’s prompts to set the desired keyboard shortcut combination for the action you want to customize.
- Save your changes, and the new shortcut will be applied.
Managing Keyboard Shortcuts
As you create and customize keyboard shortcuts, it’s essential to manage them effectively to avoid conflicts and ensure a smooth workflow. Here are some tips for managing keyboard shortcuts in Fedora Linux:
- Review existing shortcuts: Before creating a new shortcut, review the existing shortcuts to avoid conflicts and ensure your new shortcut doesn’t override an important system or application shortcut.
- Prioritize mnemonics: When creating custom shortcuts, try to use mnemonics or logical combinations that are easy to remember and relate to the associated action.
- Organize shortcuts: Consider organizing your custom shortcuts into categories or groups for better organization and easier management.
- Remove or disable unused shortcuts: Periodically review your custom shortcuts and remove or disable any that are no longer needed to keep your shortcut list clean and organized.
Troubleshooting and Advanced Tips
While working with keyboard layouts and shortcuts, you may encounter some issues or want to explore more advanced options. Here are some troubleshooting tips and advanced techniques:
- Keyboard layout conflicts: If you experience issues with keyboard layouts, such as characters not appearing correctly or shortcuts not working as expected, try resetting the keyboard layout to defaults and reconfiguring it.
- Custom keyboard layouts: Fedora Linux allows you to create custom keyboard layouts by modifying the underlying X keyboard extension (XKB) files. This advanced technique requires familiarity with the XKB configuration files and is typically reserved for specific use cases or localization requirements.
- Remapping keys: In some cases, you may want to remap specific keys on your keyboard to different functions or characters. This can be achieved using tools like
xmodmap
or thesetxkbmap
command in Fedora Linux. - Accessibility features: Fedora Linux offers various accessibility features, including sticky keys, mouse keys, and more. These can be helpful for users with specific accessibility needs or preferences.
Resources and Further Reading
If you want to learn more about keyboard layouts, shortcuts, and related topics in Fedora Linux, here are some additional resources:
- Fedora Documentation: Keyboard Configuration
- GNOME Keyboard Shortcuts
- Arch Linux Wiki: Keyboard Configuration
- Linux Journal: Custom Keyboard Layouts in Linux
- XKB Configuration Guide
By following this comprehensive tutorial, you should now have a solid understanding of how to manage keyboard layouts, create custom keyboard shortcuts, and optimize your workflow in Fedora Linux. Remember, practice and experimentation are key to mastering these techniques and finding the setup that works best for your needs.
2.8 - Fedora Linux: Notification Settings Tutorial
Understanding Notifications in Fedora
Fedora Linux uses the GNOME desktop environment by default, which provides a streamlined and user-friendly notification system. Notifications appear as small pop-ups on your desktop, typically in the top-right corner of the screen. These notifications can be generated by various applications, such as email clients, instant messaging apps, system updates, and more.
Accessing Notification Settings
To access the notification settings in Fedora, follow these steps:
- Click on the “Activities” overview button (typically located in the top-left corner of your desktop).
- Type “Notifications” in the search bar.
- Click on the “Notifications” icon to open the notification settings.
Alternatively, you can navigate to the settings menu by clicking the gear icon in the top-right corner of the desktop and selecting “Settings” > “Notifications”.
Configuring Notification Sounds
Notification sounds can help draw your attention to important events or messages. Here’s how you can manage notification sounds in Fedora:
- In the “Notifications” settings window, scroll down to the “Sounds” section.
- You can choose to enable or disable notification sounds by toggling the “Play Sound” option.
- If you want to customize the notification sound, click on the “Sound” drop-down menu and select your preferred sound from the list.
- Alternatively, you can click the “+” button to add a custom sound file from your local system.
Managing Pop-up Notifications
Pop-up notifications are the small windows that appear on your desktop when a new notification is received. You can customize the behavior and appearance of these pop-up notifications:
- In the “Notifications” settings window, scroll down to the “Pop-up Notifications” section.
- Toggle the “Show Pop-up Notifications” option to enable or disable pop-up notifications altogether.
- Adjust the “Duration” slider to set the amount of time a pop-up notification remains visible on the screen.
- Under the “Position” setting, you can choose where the pop-up notifications should appear on your desktop (top-center, bottom-center, etc.).
- The “Lock Screen” option allows you to control whether notifications should be displayed while your screen is locked.
Configuring the Notification Center
The Notification Center is a central location where you can view and manage all your notifications. Here’s how to configure it:
- In the “Notifications” settings window, scroll down to the “Notification Center” section.
- Toggle the “Show Notification Center” option to enable or disable the Notification Center.
- Adjust the “Remove Notifications After” slider to set the duration for which notifications should remain in the Notification Center before being automatically removed.
- Under the “Behavior” section, you can choose whether to group similar notifications or display them individually.
- The “Opacity” slider allows you to adjust the transparency level of the Notification Center.
Application-Specific Notification Settings
In addition to the system-wide notification settings, some applications may have their own notification preferences. You can access these settings by opening the respective application and navigating to its notification or preferences menu. For example, in the GNOME Files (Nautilus) file manager, you can find notification settings under “Edit” > “Preferences” > “Behavior” tab.
Command-Line Options
While the GNOME settings provide a user-friendly graphical interface for managing notifications, you can also configure some aspects of notifications using command-line tools. For example, the gsettings
command allows you to modify various GNOME settings, including notification settings.
To list all available notification-related keys, run the following command:
gsettings list-keys org.gnome.desktop.notifications
To modify a specific setting, use the gsettings set
command followed by the key and desired value. For example, to disable pop-up notifications, you can run:
gsettings set org.gnome.desktop.notifications show-banners false
Note that using the command-line approach requires familiarity with the GNOME settings keys and values, and it’s generally recommended to use the graphical interface for most users.
Conclusion
By following this tutorial, you should now have a solid understanding of how to manage notification settings in Fedora Linux. Customizing notifications according to your preferences can help you stay informed while minimizing distractions and maintaining an organized desktop environment.
Remember, notification settings can vary slightly between different versions of Fedora and GNOME, so it’s always a good idea to consult the official documentation or seek community support if you encounter any issues or have specific questions.
2.9 - Fedora Linux: Panel and Taskbar Configuration
GNOME Desktop Environment
GNOME is the default desktop environment in Fedora Workstation. It comes with a top panel (also known as the “top bar”) and an optional dock (called the “dash”) on the left side of the screen.
Top Panel Configuration
Right-click on the top panel and select “Preferences” or “Tweak Tool”.
In the “Top Bar” section, you can customize various aspects of the panel, such as:
- Changing the panel location (top, bottom, left, or right)
- Adjusting the panel size and auto-hide behavior
- Enabling or disabling the date, week numbers, and battery percentage displays
- Configuring the clock format and calendar preferences
- Adding or removing panel applets (e.g., volume control, network indicator, etc.)
You can also access advanced panel settings by installing the
gnome-tweaks
package:sudo dnf install gnome-tweaks
The GNOME Tweaks tool provides additional options for panel customization, such as changing the panel theme, adjusting transparency levels, and enabling desktop icons.
Dash (Dock) Configuration
- Right-click on the dash (dock) and select “Dash to Dock Settings”.
- In the settings window, you can customize various aspects of the dash, such as:
- Changing the dash position (left, right, top, or bottom)
- Adjusting the dash size, icon size, and icon spacing
- Enabling or disabling dash auto-hiding behavior
- Configuring dash appearance (opaque, transparent, or customized)
- Adding or removing dash extensions (e.g., window previews, app shortcuts, etc.)
KDE Plasma Desktop Environment
KDE Plasma provides a highly customizable desktop experience, including extensive panel and taskbar configuration options.
Right-click on the panel (taskbar) and select “Enter Edit Mode”.
Once in edit mode, you can:
- Add or remove panel widgets (such as system tray, clock, launcher, etc.)
- Adjust the panel size, position, and orientation
- Configure panel behavior (auto-hide, visibility settings, etc.)
- Customize the panel appearance (theme, transparency, background, etc.)
For more advanced settings, open the “System Settings” utility from the application menu or by pressing
Alt + F3
.Navigate to “Workspace Behavior” > “Desktop Behavior” to access additional taskbar and panel configuration options, such as:
- Configuring taskbar and panel settings (e.g., task grouping, app launchers, etc.)
- Adjusting panel and taskbar animations and visual effects
- Enabling or disabling desktop widgets and system tray icons
Xfce Desktop Environment
Xfce is a lightweight and highly configurable desktop environment with a panel (taskbar) at the top or bottom of the screen.
Right-click on the panel and select “Panel” > “Panel Preferences”.
In the “Panel Preferences” window, you can customize various aspects of the panel, such as:
- Adjusting the panel size, length, and position
- Configuring panel appearance (background, colors, transparency, etc.)
- Adding or removing panel items (launchers, applets, separators, etc.)
- Enabling or disabling panel auto-hide behavior
For more advanced settings, open the “Window Manager” application from the application menu or by pressing
Alt + F3
.Navigate to “Window Manager Tweaks” > “Workspaces” to access additional taskbar and panel configuration options, such as:
- Configuring taskbar behavior (task grouping, button styles, etc.)
- Adjusting panel and taskbar animations and visual effects
- Enabling or disabling desktop icons and system tray icons
By following these steps, you can customize your Fedora Linux panels and taskbars to suit your workflow and preferences, optimizing your workspace organization across different desktop environments.
2.10 - File Manager Configuration in Fedora Linux
Accessing Nautilus Preferences
Before diving into the configuration options, let’s first understand how to access the Nautilus preferences:
- Open the Nautilus file manager by clicking on the “Files” icon in the application launcher or by pressing the
Super
(Windows key) +E
shortcut. - Once Nautilus is open, navigate to the “Edit” menu and select “Preferences” or press
Ctrl
+Q
.
The Nautilus Preferences window will appear, providing you with several tabs to configure different aspects of the file manager.
Behavior Tab
The “Behavior” tab allows you to customize how Nautilus handles various file operations and interactions.
General Behavior
- Single Click to Open Items: Enable this option if you prefer to open files and folders with a single click instead of the default double-click behavior.
- Thumbnails: Configure the appearance of file and folder thumbnails. You can adjust the thumbnail size and choose whether to display thumbnails for specific file types.
- Date Format: Customize the date format used to display file and folder modification times.
Executable Text Files
This section allows you to specify how Nautilus should handle executable text files, such as shell scripts or programming source code files. You can choose whether to display a warning dialog, run the executable file, or disable execution entirely.
View
- Sort Folders Before Files: Enable this option to display folders before files when sorting items in a directory.
- Show Hidden Files: Toggle this option to show or hide hidden files and directories (those whose names begin with a period).
Display Tab
The “Display” tab allows you to customize the appearance of Nautilus and how it displays files and folders.
Icon View Defaults
- Use Compact Layout: Enable this option to display icons in a more compact layout, reducing the amount of white space between items.
- Default Zoom Level: Adjust the default zoom level for icon views.
- Captions: Configure the captions displayed beneath file and folder icons. You can choose from various options, such as showing the full file name, file type, or custom captions.
List View Defaults
- Default Zoom Level: Adjust the default zoom level for list views.
- Use Compact Layout: Enable this option to display files and folders in a more compact list view.
- Columns: Customize the columns displayed in the list view by selecting or deselecting specific attributes, such as file name, size, type, and modification date.
Other Previewable Files
In this section, you can specify which file types should be previewed in the Nautilus window. You can add or remove file types based on their MIME types or file extensions.
Preview Tab
The “Preview” tab allows you to configure how Nautilus handles file previews and the associated plugins.
File Contents
- Preview Text Files: Enable this option to display the contents of text files in the preview pane.
- Preview Other Previewable Files: Enable this option to preview other file types, such as images, PDF documents, and media files, in the preview pane.
Plugins
Nautilus supports various plugins that extend its functionality. In this section, you can manage installed plugins and enable or disable them according to your preferences.
Media Tab
The “Media” tab allows you to configure how Nautilus handles various media types, such as audio and video files.
Multimedia
- Automatic Run Multimedia Player: Enable this option to automatically launch the default multimedia player when opening audio or video files.
- Multimedia Viewer: Select the preferred multimedia player for handling audio and video files.
Removable Media
This section allows you to configure how Nautilus handles removable media, such as USB drives, external hard drives, and optical discs.
- Media Automount on Hot Plug: Enable this option to automatically mount removable media when connected to your system.
- Autorun Behavior: Specify how Nautilus should handle autorun features on removable media. You can choose to ignore autorun, prompt for action, or automatically run the autorun program.
Context Menu Options
Nautilus provides a context menu (right-click menu) that offers additional options and actions for files and folders. You can customize the context menu by adding, removing, or modifying menu items.
To access the context menu configuration, follow these steps:
- Open the Nautilus file manager.
- Navigate to the “Edit” menu and select “Preferences” or press
Ctrl
+Q
. - In the Preferences window, switch to the “Behavior” tab.
- Scroll down to the “Context Menu” section.
In this section, you can enable or disable various context menu items by checking or unchecking the corresponding checkboxes. Some of the available options include:
- Open in Terminal: Add a menu item to open a terminal window in the current directory.
- Scripts: Enable or disable the display of user-defined scripts in the context menu.
- Trash: Add a menu item to move the selected file(s) or folder(s) to the trash.
- Rename: Add a menu item to rename the selected file or folder.
- Compress: Add a menu item to compress the selected file(s) or folder(s) into an archive.
- Extract Here: Add a menu item to extract compressed archives in the current directory.
You can also add custom context menu items by clicking the “Add” button and specifying the required details, such as the label, command, and conditions for displaying the menu item.
File Associations
Nautilus allows you to associate specific file types with preferred applications, making it easier to open and manage different types of files. To configure file associations, follow these steps:
- Open the Nautilus file manager.
- Navigate to the “Edit” menu and select “Preferences” or press
Ctrl
+Q
. - In the Preferences window, switch to the “Behavior” tab.
- Scroll down to the “File Associations” section.
In the “File Associations” section, you’ll find a list of registered file types and their associated applications. You can modify the default application for a file type by selecting it from the list and clicking the “Set Default Application” button.
Alternatively, you can add a new file association by clicking the “Add” button and providing the necessary details, such as the file type (MIME type or file extension) and the preferred application for opening files of that type.
By following this comprehensive tutorial, you’ll be able to customize Nautilus, the default file manager in Fedora Linux, to suit your preferences and enhance your file management experience.
2.11 - Power Management Configuration in Fedora Linux
Understanding Power Management Components
Before diving into the configuration process, it’s essential to understand the key components involved in power management:
- CPU Frequency Scaling: This feature allows the system to dynamically adjust the CPU frequency based on the current workload, reducing power consumption when the system is idle or under low load.
- Display Power Management: This includes settings for screen brightness, display sleep, and screen blanking, which help conserve battery life by reducing power consumption when the display is not in use.
- Disk and Device Power Management: This feature allows the system to spin down hard disks and put devices into low-power modes when they are not in use, reducing overall power consumption.
- Battery Management: This component monitors and reports the battery status, providing information about the remaining battery life and enabling battery-saving modes.
Configuring Power Management Settings
Fedora Linux provides several graphical and command-line tools to configure power management settings. We’ll cover both methods in this tutorial.
Using the GNOME Power Manager (Graphical Interface)
The GNOME Power Manager is a graphical utility that allows you to configure various power management settings for your Fedora Linux system. To access the Power Manager, follow these steps:
- Click on the “Activities” icon (the top-left corner of the desktop).
- Search for “Power” and select “Power” from the search results.
- The Power Manager window will open, providing access to various power management settings.
Display Settings
- In the Power Manager window, click on the “Displays” section.
- Here, you can adjust the screen brightness and configure display sleep and screen blanking settings.
- Drag the “Brightness” slider to adjust the screen brightness according to your preference.
- Set the “Turn off after” and “Blank after” values to specify the duration after which the screen will turn off or go blank when the system is idle.
Power Settings
- In the Power Manager window, click on the “Power” section.
- Here, you can configure power management settings for various power sources (battery and AC power).
- Adjust the “Blank screen” and “Suspend” values to specify the duration after which the screen will go blank or the system will enter suspend mode when idle.
- Enable or disable the “Automatic Suspend” and “Automatic Brightness” options according to your preferences.
Battery Settings
- In the Power Manager window, click on the “Battery” section.
- Here, you can view the current battery status and configure battery-related settings.
- Enable or disable the “Battery Percentage” option to show or hide the battery percentage indicator in the top bar.
- Adjust the “Critical Battery Action” setting to specify the action the system should take when the battery reaches a critical level.
Using Command-Line Tools
Fedora Linux also provides command-line tools for configuring power management settings. These tools are particularly useful for server environments or situations where the graphical interface is not available.
TLP (Thermal, Linux Power)
TLP is a command-line utility that provides advanced power management features for Linux systems. It can optimize power consumption, CPU frequency scaling, disk spin-down, and more. To install TLP, run the following command:
sudo dnf install tlp tlp-rdw
After installation, TLP is enabled and starts automatically at system boot. You can configure TLP by editing the /etc/tlp.conf
file. Here are some common settings you can adjust:
# CPU Frequency Scaling
CPU_SCALING_GOVERNOR_ON_BAT=powersave
CPU_MAX_PERF_ON_BAT=30
# Disk Power Management
DISK_IOSCHED=cfq
DISK_APM_LEVEL_ON_BAT=1
# Display Power Management
RADEON_POWER_PROFILE_ON_BAT=low
RADEON_DPM_STATE_ON_BAT=battery
RADEON_DPM_PERF_LEVEL_ON_BAT=auto
# Battery Management
START_CHARGE_THRESH_BAT0=75
STOP_CHARGE_THRESH_BAT0=80
After making changes to the configuration file, you can apply the new settings by running:
sudo tlp start
CPUFreq Utils
The cpufreq-utils
package provides tools for configuring CPU frequency scaling. You can install it with the following command:
sudo dnf install kernel-tools
Once installed, you can use the cpufreq-info
command to view the current CPU frequency scaling settings and the available governors:
cpufreq-info
To change the CPU frequency scaling governor, use the cpufreq-set
command:
sudo cpufreq-set -g powersave
This command sets the CPU frequency scaling governor to “powersave” mode, which favors power efficiency over performance.
Additional Tips and Best Practices
- Use power-saving modes when running on battery power to extend battery life.
- Adjust screen brightness and sleep settings according to your usage patterns.
- Disable unnecessary services and background processes to reduce power consumption.
- Keep your system up-to-date with the latest software and kernel updates, as they often include power management improvements.
- Consider using tools like PowerTOP or TLP to analyze and optimize power consumption on your system.
Conclusion
Power management configuration is crucial for maximizing battery life and reducing power consumption on Fedora Linux systems, especially for laptops and mobile devices. By following this tutorial, you should now have a solid understanding of the various power management components and the tools available for configuring them. Remember to adjust the settings based on your specific needs and usage patterns to strike the right balance between performance and power efficiency.
2.12 - Shell Customization (Bash/Zsh) in Fedora Linux
Introduction to Shells
A shell is a command-line interface that allows users to interact with the operating system by executing commands, running scripts, and automating tasks. In Fedora Linux, the default shell is Bash (Bourne Again SHell), but there are alternative shells available, such as Zsh (Z SHell).
Both Bash and Zsh offer extensive customization options, allowing users to tailor their shell environment to their preferences and enhance their productivity.
Bash Customization
Bash is the default shell in most Linux distributions, including Fedora. Customizing Bash involves modifying configuration files and creating scripts.
Configuring the Bash Prompt
The Bash prompt is the line that appears before you type a command, and it can be customized to display various information, such as the current working directory, user name, hostname, and more.
To customize the Bash prompt, edit the ~/.bashrc
file using a text editor like nano
or vim
:
nano ~/.bashrc
Add the following line to the file, replacing \u
with the desired prompt format:
export PS1="\u@\h:\w$ "
Here’s what the various escape sequences mean:
\u
: Current user’s username\h
: Hostname (short form)\W
: Current working directory (short form)\w
: Current working directory (full path)\$
: Displays$
for regular users or#
for root
After saving the file, either restart your terminal or run source ~/.bashrc
for the changes to take effect.
Creating Bash Aliases
Aliases are shortcuts that allow you to execute commands or a series of commands with a single word. They can save you time and effort by reducing the need to type long commands repeatedly.
To create a Bash alias, open the ~/.bashrc
file and add the following line:
alias shortcut='command'
Replace shortcut
with the desired alias name and command
with the actual command or series of commands you want to execute.
For example, to create an alias ll
for the ls -l
command, add the following line:
alias ll='ls -l'
After saving the file, either restart your terminal or run source ~/.bashrc
for the aliases to take effect.
Writing Bash Scripts
Bash scripts are files containing a sequence of Bash commands that can be executed as a single unit. Scripts are useful for automating repetitive tasks, performing complex operations, and creating custom tools.
To create a Bash script, open a text editor and start writing your commands. Save the file with a .sh
extension, for example, myscript.sh
.
Here’s a basic example of a Bash script that displays a greeting:
#!/bin/bash
echo "Hello, World!"
The first line #!/bin/bash
is called the shebang line and tells the system which interpreter to use for executing the script.
To run the script, navigate to the directory where the script is located and execute the following command:
bash myscript.sh
Alternatively, you can make the script executable and run it directly:
chmod +x myscript.sh
./myscript.sh
Bash scripts can include variables, conditionals, loops, functions, and more, allowing you to create powerful and complex scripts.
Zsh Customization
Zsh is an alternative shell that offers advanced features and extensive customization options. It’s known for its powerful auto-completion, spelling correction, and various plugins and themes.
Installing Zsh
Zsh may not be installed by default on Fedora Linux. To install it, open a terminal and run the following command:
sudo dnf install zsh
After the installation is complete, you can switch to Zsh by running the following command:
zsh
Configuring the Zsh Prompt
Similar to Bash, you can customize the Zsh prompt by modifying the ~/.zshrc
file. Open the file in a text editor:
nano ~/.zshrc
Add the following line to set the prompt format:
PROMPT="%n@%m:%~%# "
Here’s what the various escape sequences mean:
%n
: Current user’s username%m
: Machine (hostname)%~
: Current working directory%#
: Displays%
for regular users or#
for root
After saving the file, either restart your terminal or run source ~/.zshrc
for the changes to take effect.
Creating Zsh Aliases
Creating aliases in Zsh is similar to Bash. Open the ~/.zshrc
file and add the following line:
alias shortcut='command'
Replace shortcut
with the desired alias name and command
with the actual command or series of commands you want to execute.
For example, to create an alias ll
for the ls -l
command, add the following line:
alias ll='ls -l'
After saving the file, either restart your terminal or run source ~/.zshrc
for the aliases to take effect.
Writing Zsh Scripts
Writing Zsh scripts is similar to writing Bash scripts. Create a file with a .zsh
extension and start writing your commands.
Here’s a basic example of a Zsh script that displays a greeting:
#!/bin/zsh
echo "Hello, World!"
To run the script, navigate to the directory where the script is located and execute the following command:
zsh myscript.zsh
Alternatively, you can make the script executable and run it directly:
chmod +x myscript.zsh
./myscript.zsh
Zsh scripts can include variables, conditionals, loops, functions, and more, just like Bash scripts.
Additional Customization Options
Besides prompt settings, aliases, and scripting, there are several other ways to enhance your shell experience.
Customizing the Terminal Appearance
You can customize the appearance of your terminal by changing the color scheme, font, and background. In Fedora Linux, you can access these settings through the terminal application’s preferences or by installing a terminal emulator like Terminator or Tilix.
Enabling Tab Completion
Both Bash and Zsh support tab completion, which allows you to auto-complete commands, file paths, and more by pressing the Tab key. This feature can significantly boost your productivity by reducing the need for typing long commands or file paths.
In Bash, tab completion is enabled by default. In Zsh, you can enable advanced tab completion by installing and configuring a plugin like zsh-autosuggestions
or zsh-syntax-highlighting
.
Syntax Highlighting
Syntax highlighting is a feature that highlights different parts of your commands and scripts with different colors, making it easier to read and understand the code. Both Bash and Zsh have syntax highlighting plugins or extensions available.
In Bash, you can use the bash-syntax-highlighting
package, which can be installed using the package manager:
sudo dnf install bash-syntax-highlighting
In Zsh, you can use the zsh-syntax-highlighting
plugin, which can be installed using a plugin manager like zinit
or `z
2.13 - System Font Configuration in Fedora Linux
Understanding Font Rendering
Font rendering is the process of converting font outlines into bitmaps that can be displayed on the screen. FreeType employs different rendering techniques, such as anti-aliasing, hinting, and sub-pixel rendering, to enhance the appearance of fonts at various sizes.
Anti-Aliasing
Anti-aliasing is a technique that smooths the edges of fonts by adding partially transparent pixels along the boundaries, making them appear smoother and less jagged.
Hinting
Hinting is a process that aligns the outlines of fonts to the rasterized pixel grid, improving their legibility, especially at smaller sizes.
Sub-Pixel Rendering
Sub-pixel rendering is a technique that takes advantage of the individual red, green, and blue components of a pixel to increase the perceived resolution of fonts, resulting in smoother and crisper text rendering.
Configuring System Fonts
In Fedora Linux, system-wide font settings are stored in the /etc/fonts/local.conf
file. This file is used by FreeType to determine how fonts should be rendered on your system. Here’s how you can modify this file to customize font rendering:
Open the
/etc/fonts/local.conf
file using your preferred text editor with root privileges:sudo nano /etc/fonts/local.conf
Inside the file, you’ll find various options organized into different sections. Here are some common settings you can adjust:
<?xml version="1.0"?> <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <fontconfig> <!-- Anti-Aliasing --> <match target="font"> <edit name="antialias" mode="assign"> <bool>true</bool> </edit> </match> <!-- Hinting --> <match target="font"> <edit name="hinting" mode="assign"> <bool>true</bool> </edit> </match> <match target="font"> <edit name="hintstyle" mode="assign"> <const>hintslight</const> </edit> </match> <!-- Sub-Pixel Rendering --> <match target="font"> <edit name="rgba" mode="assign"> <const>rgb</const> </edit> </match> </fontconfig>
<edit name="antialias">
: Set to<bool>true</bool>
to enable anti-aliasing or<bool>false</bool>
to disable it.<edit name="hinting">
: Set to<bool>true</bool>
to enable hinting or<bool>false</bool>
to disable it.<edit name="hintstyle">
: Determine the hinting style. Possible values arehintnone
,hintslight
,hintmedium
, andhintfull
.<edit name="rgba">
: Set the sub-pixel rendering mode. Possible values arenone
,rgb
,bgr
,vrgb
, andvbgr
.
After making your desired changes, save the file and exit the text editor.
To apply the new font configuration settings, restart the font cache by running the following command:
sudo fc-cache -f -v
This command will rebuild the font cache and ensure that the new settings take effect immediately.
Additional Font Configuration Options
Apart from the system-wide settings in /etc/fonts/local.conf
, you can also configure font rendering on a per-user basis by creating a ~/.config/fontconfig/fonts.conf
file in your home directory. This file follows the same syntax as /etc/fonts/local.conf
and allows you to override system-wide settings for your user account.
Additionally, some desktop environments, such as GNOME or KDE, provide graphical tools for configuring font settings. These tools often provide a user-friendly interface for adjusting font rendering options, making it easier for users who prefer a visual approach.
Troubleshooting Font Issues
If you encounter any issues with font rendering after making changes to the configuration files, you can try the following troubleshooting steps:
Verify that your changes are correctly formatted in the configuration files. XML syntax errors can prevent the settings from being applied correctly.
Check if any desktop environment or application-specific font settings are overriding your system-wide configuration.
Try clearing the font cache and rebuilding it using the
fc-cache -f -v
command.If the issue persists, you can try resetting the font configuration to the default settings by removing or renaming the
/etc/fonts/local.conf
file and rebuilding the font cache.
Conclusion
By following this tutorial, you should now have a better understanding of font rendering in Fedora Linux and how to configure system fonts to improve readability and visual appeal. Remember, font rendering preferences can be subjective, so feel free to experiment with different settings until you find the combination that works best for your eyes and needs.
2.14 - Wallpaper and Screensaver Configuration
Changing the Desktop Wallpaper
Fedora comes with a collection of pre-installed wallpapers, and you can also use your own images as wallpapers. Here’s how you can change the desktop wallpaper:
Right-click on the desktop and select “Change Desktop Background” or “Change Wallpaper” (depending on your desktop environment).
The “Background Preferences” or “Wallpaper Preferences” window will appear, providing you with different options to choose and configure your wallpaper.
In the “Background” tab, you can select from various pre-installed wallpapers by clicking on the thumbnails or by navigating through the directories in the left pane.
If you want to use your own image as a wallpaper, click on the “+” button at the bottom of the window and select your desired image file.
The selected image will be added to the list of available wallpapers. You can preview it by clicking on the thumbnail.
Adjust the wallpaper settings according to your preferences. You can choose to fill the screen, center the image, stretch it, or set it to span across multiple displays if you have a multi-monitor setup.
You can also configure the wallpaper to change at specific intervals by selecting the “Change Background” option in the “Background” tab and specifying the desired interval.
Once you’re satisfied with your choices, click “Close” or “Apply” to save the changes and apply the new wallpaper.
Configuring the Screensaver
Screensavers are designed to protect your display from burn-in and add a touch of personalization to your desktop. Here’s how you can configure the screensaver settings in Fedora:
Open the “Settings” application or right-click on the desktop and select “Settings” or “Preferences.”
In the “Settings” window, navigate to the “Screensaver” or “Power Management” section.
Here, you can choose a screensaver from the list of available options. Fedora provides several built-in screensavers, ranging from simple blank screens to animated graphics and photos.
After selecting a screensaver, you can customize its settings by clicking on the “Preferences” or “Settings” button next to it.
Adjust the screensaver’s properties, such as the delay before activation, the behavior when the screensaver is running (e.g., locking the screen or requiring a password to dismiss it), and any other specific settings for the chosen screensaver.
Some screensavers may offer additional options, like displaying random images from a folder or adjusting the animation speed.
You can also configure the power management settings in the same section, which control the behavior of your display and system when it is idle or inactive for a certain period.
Once you’ve made your desired changes, click “Close” or “Apply” to save the settings.
Additional Tips and Tricks
You can use online resources or dedicated wallpaper websites to find and download high-quality wallpapers for your desktop.
If you have a multi-monitor setup, you can set different wallpapers for each display by selecting the appropriate display in the wallpaper preferences window.
Some desktop environments, like GNOME, offer additional extensions or plugins that provide more advanced wallpaper and screensaver customization options. You can explore these extensions from the respective extension repositories.
Fedora also supports live wallpapers, which are animated or interactive wallpapers. You can find and install live wallpaper packages from the Fedora repositories or third-party sources.
If you prefer a minimalist approach, you can choose a solid color or a simple pattern as your wallpaper by selecting the appropriate option in the wallpaper preferences window.
Customizing your desktop environment with personalized wallpapers and screensavers is a great way to make your Fedora experience more visually appealing and tailored to your preferences. Experiment with different options and find the combination that suits your style and needs best.
2.15 - Window Manager Tweaks on Fedora Linux
Introduction
In this tutorial, we’ll explore various tweaks and customizations you can apply to your window manager on Fedora Linux, enhancing your desktop experience and improving productivity. We’ll cover window behavior, keyboard shortcuts, window decorations, and more.
Prerequisites
Before diving into the tweaks, ensure that you have the following prerequisites:
- A working installation of Fedora Linux
- A desktop environment installed (e.g., GNOME, KDE Plasma, Xfce, or others)
- Basic knowledge of using the terminal and text editor
Window Behavior
Window Snapping and Tiling
Many window managers offer built-in features for snapping windows to the edges of the screen or tiling them in various layouts. These features can significantly improve your multitasking experience and workspace organization.
GNOME:
- Enable the “Window Tiling” extension from the GNOME Extensions website or the built-in Tweaks tool.
- Use keyboard shortcuts like
Super + Left/Right
to snap windows to the left or right half of the screen, orSuper + Up/Down
to maximize or restore windows.
KDE Plasma:
- Navigate to “System Settings > Window Management > Window Behavior” and enable the “Window Tiling” option.
- Use keyboard shortcuts like
Meta + Left/Right
to snap windows to the left or right half of the screen, orMeta + Up/Down
to maximize or restore windows.
Xfce:
- Install the “Window Tiling” plugin from the Xfce Panel’s “Window Manager Tweaks” section.
- Use keyboard shortcuts like
Super + Left/Right
to snap windows to the left or right half of the screen, orSuper + Up/Down
to maximize or restore windows.
Window Focus and Raising
Customize how windows are focused and raised when clicked or hovered over.
GNOME:
- Use the built-in Tweaks tool to adjust “Window Focus” settings, such as “Click to Focus” or “Focus on Hover.”
KDE Plasma:
- Navigate to “System Settings > Window Management > Window Behavior” and adjust the “Focus” and “Focus Stealing Prevention” options.
Xfce:
- Navigate to “Settings > Window Manager Tweaks > Focus” and adjust the focus behavior settings.
Window Placement and Positioning
Control how new windows are positioned and placed on the screen.
GNOME:
- Use the built-in Tweaks tool to adjust “Window Tiling” and “Window Placement” settings.
KDE Plasma:
- Navigate to “System Settings > Window Management > Window Behavior” and adjust the “Window Placement” and “Window Tiling” options.
Xfce:
- Navigate to “Settings > Window Manager Tweaks > Placement” and adjust the window placement settings.
Keyboard Shortcuts
Keyboard shortcuts can significantly enhance your productivity by allowing you to perform common tasks quickly without having to navigate through menus or use the mouse.
Modifying Existing Shortcuts
Most desktop environments provide a way to view and modify existing keyboard shortcuts.
GNOME:
- Use the built-in “Settings > Keyboard Shortcuts” tool to view and modify keyboard shortcuts for various actions, such as window management, launching applications, and more.
KDE Plasma:
- Navigate to “System Settings > Shortcuts” to view and modify keyboard shortcuts for various components and actions.
Xfce:
- Navigate to “Settings > Keyboard” to view and modify keyboard shortcuts for various actions.
Creating Custom Shortcuts
In addition to modifying existing shortcuts, you can also create your own custom shortcuts for specific actions or commands.
GNOME:
- Use the built-in “Settings > Keyboard Shortcuts” tool and click the “+” button to create a new custom shortcut.
KDE Plasma:
- Navigate to “System Settings > Shortcuts > Custom Shortcuts” and click the “Edit” button to create a new custom shortcut.
Xfce:
- Navigate to “Settings > Keyboard” and click the “Application Shortcuts” tab to create new custom shortcuts for specific applications or commands.
Window Decorations
Window decorations refer to the visual elements surrounding application windows, such as the title bar, borders, and window control buttons (minimize, maximize, close). Customizing these decorations can give your desktop a fresh and personalized look.
Changing the Window Theme
Most desktop environments provide a selection of pre-installed window themes or allow you to install additional themes from their respective repositories or online sources.
GNOME:
- Use the built-in Tweaks tool or the “Settings > Appearance” tool to browse and apply different window themes.
KDE Plasma:
- Navigate to “System Settings > Appearance > Window Decorations” to browse and apply different window decoration themes.
Xfce:
- Navigate to “Settings > Window Manager > Style” to browse and apply different window themes.
Customizing Window Decorations
Some window managers allow you to customize individual elements of the window decorations, such as the title bar layout, button placements, and more.
GNOME:
- Use the built-in Tweaks tool or the “Settings > Appearance” tool to adjust various window decoration options, such as button layout and title bar appearance.
KDE Plasma:
- Navigate to “System Settings > Appearance > Window Decorations” and click the “Configure Decoration…” button to customize various aspects of the window decorations.
Xfce:
- Navigate to “Settings > Window Manager Tweaks > Window Decorations” to customize the appearance of window decorations.
Using Custom Window Decoration Themes
If the pre-installed window decoration themes don’t meet your needs, you can explore and install custom themes from online sources or create your own.
GNOME:
- Search for and install custom GNOME Shell themes from the GNOME Extensions website or other online repositories.
KDE Plasma:
- Search for and install custom KDE window decoration themes from online sources like the KDE Store or other repositories.
Xfce:
- Search for and install custom Xfce window decoration themes from online sources or create your own by modifying the relevant configuration files.
Advanced Tweaks
For more advanced users or those seeking even more customization options, there are additional tweaks and configurations you can explore.
Editing Configuration Files
Most window managers store their configuration settings in text-based configuration files, typically located in the user’s home directory or system-wide directories. By editing these files, you can fine-tune various aspects of the window manager’s behavior and appearance.
GNOME:
- GNOME settings are stored in the DConf database, which can be edited using the
dconf-editor
tool or by creating custom overrides in the~/.config/dconf/user
directory.
- GNOME settings are stored in the DConf database, which can be edited using the
KDE Plasma:
- KDE settings are stored in various configuration files, typically located in the
~/.config/kdeglobals
and~/.config/kwinrc
directories.
- KDE settings are stored in various configuration files, typically located in the
Xfce:
- Xfce settings are stored in various configuration files, typically located in the
~/.config/xfce4
directory.
- Xfce settings are stored in various configuration files, typically located in the
Note: Exercise caution when editing configuration files directly, as incorrect modifications can potentially cause issues or undesired behavior.
Using Advanced Configuration Tools
Some window managers provide advanced configuration tools or graphical utilities that allow for more extensive customization options.
GNOME:
- The
gnome-tweaks
tool provides additional customization options for various GNOME Shell components, including window behavior and appearance.
- The
KDE Plasma:
- The “System Settings” application in KDE Plasma offers a wide range of configuration
3 - Package Management
4 - System Administration
4.1 - Automating Tasks with Cron
Understanding Cron
Before diving into the details, let’s understand the basic components of cron:
Crontab: A crontab (cron table) is a file that contains instructions for cron on which commands to run and when to run them. Each user on the system can have their own crontab file.
Cron Daemon: The cron daemon (
crond
) is a background process that runs continuously and checks the crontab files at regular intervals to execute the scheduled commands.Cron Syntax: The crontab entries follow a specific syntax consisting of the following fields:
* * * * * command | | | | | | | | | +-- Day of the week (0-7, where 0 or 7 represents Sunday) | | | +---- Month (1-12) | | +------ Day of the month (1-31) | +-------- Hour (0-23) +---------- Minute (0-59)
You can use various combinations of these fields to specify when you want the command to run. Additionally, you can use special characters like
*
(all values),,
(value list separator),-
(range of values), and/
(step values).
Setting Up Cron
In Fedora Linux, the cron service is typically enabled by default. However, you can check its status and start it if necessary:
sudo systemctl status crond
If the service is not running, you can start it with:
sudo systemctl start crond
To ensure that cron starts automatically after system reboots, enable it:
sudo systemctl enable crond
Editing Crontab
To add, edit, or remove cron jobs, you need to edit your crontab file. Use the following command to open the crontab editor:
crontab -e
This will open the default editor (usually nano or vi) and allow you to edit your crontab file.
Scheduling Tasks
Now let’s look at some examples of scheduling tasks with cron.
Example 1: Running a script daily at a specific time
Suppose you want to run a script named backup.sh
located in the /home/user/scripts
directory every day at 2:00 AM. Add the following line to your crontab:
0 2 * * * /home/user/scripts/backup.sh
This entry tells cron to execute the backup.sh
script every day at 2:00 AM.
Example 2: Running a command weekly
To run a command every Monday at 10:00 PM, add the following line to your crontab:
0 22 * * 1 /path/to/command
The 1
in the last field represents Monday (0 for Sunday, 1 for Monday, and so on).
Example 3: Running a task every 5 minutes
If you want to execute a task every 5 minutes, use the following entry:
*/5 * * * * /path/to/command
The */5
in the minute field means “every 5 minutes.”
Example 4: Redirecting output to a log file
Sometimes, you might want to redirect the output of a cron job to a log file. You can do this by appending the output redirection operators (>
or >>
) to your cron entry:
0 2 * * * /path/to/script > /path/to/logfile.log 2>&1
This will redirect both standard output and standard error to the specified log file (logfile.log
).
Advanced Cron Syntax
Cron syntax also supports more advanced patterns and abbreviations:
- Ranges: Use a hyphen
-
to specify a range of values (e.g.,1-5
for hours 1 through 5). - Lists: Use commas
,
to separate individual values or ranges (e.g.,1,3,5
for hours 1, 3, and 5). - Step Values: Use the
/
symbol to specify a step value (e.g.,*/5
for every 5 minutes,0-23/2
for every 2 hours). - Abbreviations: Use
@yearly
,@monthly
,@weekly
,@daily
,@hourly
, or@reboot
instead of the corresponding time values.
For example, to run a command every hour between 8:00 AM and 5:00 PM on weekdays, you could use:
0 8-17 * * 1-5 /path/to/command
Managing Crontab Entries
You can use the following commands to manage your crontab entries:
crontab -e
: Open the crontab editor to add, edit, or remove entries.crontab -l
: List the current crontab entries.crontab -r
: Remove (delete) the current crontab file.
System-wide Cron Jobs
In addition to user-specific crontab files, Fedora Linux also has a system-wide crontab directory located at /etc/cron.d/
. System administrators can place cron job files in this directory to schedule system-level tasks.
Logging and Monitoring
Cron logs its activities in the /var/log/cron
file. You can monitor this log file for any errors or issues with your cron jobs. Additionally, you can use tools like logrotate
to manage and rotate the cron log files.
Best Practices
When working with cron, it’s recommended to follow these best practices:
- Test your scripts and commands thoroughly before scheduling them with cron.
- Use full paths for commands and scripts in your crontab entries to avoid potential issues with the system’s PATH variable.
- Consider redirecting output to log files for easier monitoring and debugging.
- Avoid scheduling resource-intensive tasks during peak usage times.
- Use cron judiciously and schedule tasks only when necessary to minimize system load.
Conclusion
Cron is a powerful tool for automating repetitive tasks and system maintenance in Fedora Linux. By understanding the cron syntax and leveraging its scheduling capabilities, you can streamline your workflows and improve system efficiency. Remember to exercise caution when scheduling tasks and always test your scripts before deploying them in a production environment.
4.2 - Firewall Configuration
firewalld
and iptables
. This tutorial will guide you through the process of configuring the firewall using both methods.Part 1: Configuring the Firewall with firewalld
Fedora Linux uses firewalld
as the default firewall management tool. It provides a user-friendly interface for managing firewall rules and zones.
1.1 Checking the firewalld Status
Before you begin, ensure that firewalld
is installed and running. You can check its status with the following command:
sudo systemctl status firewalld
If firewalld
is not running, you can start it with:
sudo systemctl start firewalld
1.2 Understanding Zones
firewalld
uses the concept of zones to manage firewall rules. Each zone represents a set of rules that apply to network interfaces. The default zone is the public
zone, which is used for incoming connections that are not trusted.
To list all available zones, run:
sudo firewall-cmd --get-zones
1.3 Configuring Firewall Rules
You can configure firewall rules using the firewall-cmd
command. Here are some common operations:
- Opening a port for a specific service:
sudo firewall-cmd --zone=public --add-service=http --permanent
This command opens port 80 (HTTP) in the public
zone. The --permanent
option makes the change persistent across reboots.
- Opening a specific port:
sudo firewall-cmd --zone=public --add-port=8080/tcp --permanent
This command opens port 8080 for TCP traffic in the public
zone.
- Removing a service or port:
sudo firewall-cmd --zone=public --remove-service=http --permanent
sudo firewall-cmd --zone=public --remove-port=8080/tcp --permanent
- Listing all allowed services and ports:
sudo firewall-cmd --zone=public --list-services
sudo firewall-cmd --zone=public --list-ports
- Reloading the firewall rules:
sudo firewall-cmd --reload
After making changes, you must reload the firewall rules for them to take effect.
1.4 Configuring Firewall Zones
You can also change the zone for a specific network interface. For example, to change the zone for the enp0s3
interface to the trusted
zone, run:
sudo firewall-cmd --zone=trusted --change-interface=enp0s3 --permanent
1.5 Rich Rules
firewalld
supports rich rules, which allow you to create more complex firewall rules based on various criteria, such as source and destination IP addresses, ports, and protocols. Rich rules are specified using a syntax similar to iptables
rules.
To add a rich rule, use the --add-rich-rule
option:
sudo firewall-cmd --zone=public --add-rich-rule='rule family="ipv4" source address="192.168.1.0/24" port port=22 protocol=tcp accept' --permanent
This rule allows incoming SSH connections from the 192.168.1.0/24 network on the public
zone.
Part 2: Configuring the Firewall with iptables
iptables
is a low-level firewall management tool that provides granular control over network packet filtering. While firewalld
is the recommended tool for Fedora Linux, some advanced users may prefer to use iptables
directly.
2.1 Installing iptables
iptables
is typically installed by default on Fedora Linux. If it’s not installed, you can install it with:
sudo dnf install iptables-services
2.2 Understanding iptables Chains
iptables
uses chains to organize firewall rules. The three built-in chains are:
INPUT
: Handles incoming packets.OUTPUT
: Handles outgoing packets.FORWARD
: Handles packets being routed through the system.
2.3 Configuring iptables Rules
You can configure iptables
rules using the iptables
command. Here are some common operations:
- Opening a port for a specific service:
sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT
This command allows incoming TCP traffic on port 80 (HTTP).
- Blocking a specific IP address:
sudo iptables -A INPUT -s 192.168.1.100 -j DROP
This command drops all incoming packets from the IP address 192.168.1.100.
- Saving and restoring rules:
sudo iptables-save > /path/to/rules.v4
sudo iptables-restore < /path/to/rules.v4
iptables
rules are not persistent across reboots. You can save and restore them using the iptables-save
and iptables-restore
commands.
2.4 Advanced iptables Rules
iptables
supports advanced rule matching based on various criteria, such as source and destination IP addresses, ports, protocols, and packet states. Here’s an example of a more complex rule:
sudo iptables -A INPUT -p tcp --dport 22 -m state --state NEW,ESTABLISHED -j ACCEPT
sudo iptables -A OUTPUT -p tcp --sport 22 -m state --state ESTABLISHED -j ACCEPT
These rules allow incoming and outgoing SSH connections while maintaining stateful tracking of the connections.
2.5 Flushing iptables Rules
To remove all existing iptables
rules and start with a clean slate, use the following command:
sudo iptables -F
This command flushes all chains and removes all rules.
Conclusion
Configuring the firewall is an essential task for securing your Fedora Linux system. This tutorial covered the two main methods for firewall configuration: firewalld
and iptables
. While firewalld
is the recommended tool for most users, iptables
provides more advanced options for experienced administrators.
Remember to carefully consider your security requirements and test your firewall rules to ensure that they are working as intended. Regular monitoring and maintenance of your firewall configuration are also recommended to keep your system secure.
4.3 - Kernel Management
Introduction to the Linux Kernel
The Linux kernel is the central component of the Linux operating system. It acts as an interface between the hardware and the user applications, managing system resources and providing various services to the applications. The kernel is responsible for tasks such as process management, memory management, file system management, device management, and network management.
In Fedora Linux, the kernel is part of the core operating system and is regularly updated to provide bug fixes, security patches, and new features. Fedora follows a rolling release model, which means that new kernel versions are continuously released and made available for installation.
Displaying Kernel Information
Before diving into kernel management, it’s helpful to know how to display information about the currently running kernel. You can use the following commands to obtain kernel-related information:
Display the kernel version:
uname -r
This command will show the release version of the currently running kernel.
Display detailed kernel information:
uname -a
This command displays detailed information about the kernel, including the kernel version, the hostname, the kernel release date, and more.
View kernel boot parameters:
cat /proc/cmdline
This command displays the kernel boot parameters that were passed to the kernel during the boot process.
Managing Kernel Modules
Kernel modules are pieces of code that can be loaded and unloaded into the kernel upon demand. They extend the functionality of the kernel by providing support for additional hardware devices, filesystems, network protocols, and more. Managing kernel modules is an essential part of kernel management.
Listing Loaded Modules
To list the currently loaded kernel modules, you can use the following command:
lsmod
This command displays a list of loaded modules, along with information such as the module size, the number of instances loaded, and the dependencies.
Loading and Unloading Modules
To load a kernel module, you can use the modprobe
command:
sudo modprobe module_name
Replace module_name
with the name of the kernel module you want to load.
To unload a kernel module, you can use the modprobe
command with the -r
option:
sudo modprobe -r module_name
Replace module_name
with the name of the kernel module you want to unload.
Persisting Module Configuration
By default, when you load or unload a kernel module, the change is temporary and will not persist across system reboots. To make the module configuration persistent, you need to modify the appropriate configuration file.
In Fedora, the configuration files for kernel modules are typically located in the /etc/modules-load.d/
directory. You can create a new configuration file (e.g., my-modules.conf
) in this directory and add the names of the modules you want to load or unload at boot time, one per line.
For example, to load the module1
and module2
modules at boot time, create a file /etc/modules-load.d/my-modules.conf
with the following contents:
module1
module2
Similarly, to unload the module3
module at boot time, create a file /etc/modules-load.d/blacklist.conf
with the following content:
blacklist module3
After making changes to the configuration files, you need to rebuild the initramfs (initial RAM filesystem) for the changes to take effect. You can do this by running the following command:
sudo dracut --force --verbose
Configuring Kernel Parameters
Kernel parameters are settings that control various aspects of the kernel’s behavior. These parameters can be configured to optimize the system’s performance, enable or disable certain features, or adjust kernel settings for specific hardware configurations.
Viewing Current Kernel Parameters
To view the current kernel parameters, you can use the sysctl
command:
sysctl -a
This command displays a list of all available kernel parameters and their current values.
Setting Kernel Parameters at Runtime
You can temporarily change the value of a kernel parameter using the sysctl
command:
sudo sysctl -w kernel.parameter=value
Replace kernel.parameter
with the name of the kernel parameter you want to modify, and value
with the desired value for that parameter.
For example, to change the value of the kernel.shmmax
parameter (which controls the maximum shared memory segment size) to 64GB
, you can run:
sudo sysctl -w kernel.shmmax=68719476736
Persisting Kernel Parameter Changes
Similar to kernel module configuration, changes made to kernel parameters using sysctl
are temporary and will not persist across system reboots. To make kernel parameter changes persistent, you need to modify the appropriate configuration file.
In Fedora, the configuration file for kernel parameters is typically located at /etc/sysctl.d/
. You can create a new configuration file (e.g., my-sysctl.conf
) in this directory and add the kernel parameter settings you want to persist, one per line.
For example, to persist the kernel.shmmax
setting from the previous example, create a file /etc/sysctl.d/my-sysctl.conf
with the following content:
kernel.shmmax=68719476736
After making changes to the configuration file, you need to apply the changes by running:
sudo sysctl --system
This command will load the new kernel parameter settings from the configuration files in the /etc/sysctl.d/
directory.
Updating the Kernel
Fedora Linux provides regular kernel updates to address security vulnerabilities, fix bugs, and introduce new features. Keeping your kernel up-to-date is essential for maintaining system stability and security.
Checking for Kernel Updates
To check if there are any available kernel updates, you can use the dnf
package manager:
sudo dnf check-update kernel*
This command will list any available kernel updates, along with information about the updated packages.
Installing Kernel Updates
To install the latest kernel updates, you can use the dnf
package manager:
sudo dnf update kernel*
This command will download and install the latest kernel updates, along with any other package updates that may be available.
After installing the kernel updates, you will need to reboot your system to start using the new kernel version.
Removing Old Kernel Versions
Fedora Linux maintains multiple kernel versions to ensure that you have a fallback option in case of any issues with the latest kernel version. However, over time, old kernel versions can accumulate and take up disk space.
To remove old kernel versions, you can use the dnf
package manager with the autoremove
option:
sudo dnf autoremove
This command will remove any old kernel packages that are no longer needed, freeing up disk space.
Troubleshooting Kernel Issues
Despite the best efforts of Linux developers and distributors, kernel issues can sometimes arise. In this section, we’ll cover some
4.4 - Managing System Services
systemd
system and service manager. The systemd
suite is responsible for initializing the system in the boot process and controlling system processes after boot. It provides a standard process for starting, stopping, restarting, enabling, and disabling system services.Understanding Systemd Units
In systemd, services are represented as units, which are resources that the system knows how to manage. There are different unit types, but the most common are service units (.service) and socket units (.socket).
- Service Units: Represent system services, such as an HTTP server or a database server.
- Socket Units: Represent an inter-process communication (IPC) socket, which is used for activating services.
Each unit is defined in a unit file, typically located in the /usr/lib/systemd/system/
or /etc/systemd/system/
directories.
Listing System Services
To list all available system services on your Fedora system, use the following command:
systemctl list-unit-files --type=service
This command will display a list of all installed service unit files, along with their state (enabled or disabled).
Starting and Stopping Services
To start a service, use the following command:
sudo systemctl start service_name.service
Replace service_name.service
with the name of the service you want to start. For example, to start the Apache HTTP Server, use:
sudo systemctl start httpd.service
To stop a running service, use the following command:
sudo systemctl stop service_name.service
You can also restart a service by using the restart
command:
sudo systemctl restart service_name.service
Enabling and Disabling Services
Enabling a service ensures that it starts automatically at system boot. To enable a service, use the following command:
sudo systemctl enable service_name.service
To disable an enabled service and prevent it from starting at boot, use the following command:
sudo systemctl disable service_name.service
Checking Service Status
To check the current status of a service, use the following command:
systemctl status service_name.service
This command will display the service’s current status (active, inactive, or failed), along with any recent log messages related to the service.
Managing Services with systemctl
The systemctl
command provides a powerful interface for managing system services. Here are some additional useful commands:
systemctl list-units
: List all currently loaded units.systemctl list-units --type=service --state=active
: List all active services.systemctl daemon-reload
: Reload systemd configuration files.systemctl reset-failed
: Reset failed services to their default state.systemctl mask service_name.service
: Mask (disable) a service, preventing it from being started.systemctl unmask service_name.service
: Unmask (enable) a previously masked service.
Modifying Service Configuration
Most service configuration files are located in the /etc/systemd/system/
or /usr/lib/systemd/system/
directories. You can modify these configuration files to change service behavior, such as environment variables or startup options.
However, it’s generally recommended to create a new configuration file in the /etc/systemd/system/
directory with your custom settings. This ensures that your changes won’t be overwritten during system updates.
For example, to modify the Apache HTTP Server configuration, create a new file called /etc/systemd/system/httpd.service.d/custom.conf
with your custom settings:
[Service]
Environment=APACHE_LOCK_DIR=/var/run/apache2/lock
After making changes to service configuration files, run the following command to reload the systemd configuration:
sudo systemctl daemon-reload
Logging and Debugging
Systemd provides comprehensive logging capabilities for services. Service logs are typically stored in the /var/log/
directory, and you can view them using the journalctl
command.
To view all log entries for a specific service, use the following command:
journalctl -u service_name.service
You can also follow the log in real-time with the -f
(follow) option:
journalctl -u service_name.service -f
If you encounter issues with a service, you can increase the logging verbosity by modifying the service configuration file and adding the following line:
[Service]
Environment=SYSTEMD_LOG_LEVEL=debug
After making this change, reload the systemd configuration and restart the service to enable debug logging.
Conclusion
Managing system services in Fedora Linux with systemd is a powerful and flexible process. By understanding the basic commands and concepts, you can effectively start, stop, enable, disable, and manage services on your Fedora system. Additionally, systemd provides advanced features for service configuration, logging, and debugging, allowing you to tailor services to your specific needs.
4.5 - Network Configuration
Introduction to Network Configuration
Network configuration in Fedora Linux involves setting up various network components, such as wired or wireless connections, IP addresses, DNS servers, and network interfaces. Fedora provides several tools and utilities to manage network settings, catering to both graphical and command-line preferences.
Graphical Network Configuration
GNOME Network Settings
Fedora’s default desktop environment, GNOME, includes a graphical network settings tool that allows you to easily configure network connections.
- Open the GNOME Settings by clicking on the “Settings” icon in the Activities overview or by pressing the
Super
(Windows) key and typing “Settings”. - Navigate to the “Network” section.
- Here, you can view and manage your available network connections, including wired and wireless networks.
- To configure a wired connection, click on the “Wired” tab and select your wired connection from the list.
- To configure a wireless connection, click on the “Wireless” tab and select your desired wireless network from the list.
- After selecting a network connection, you can configure various settings, such as the IPv4 or IPv6 method (automatic or manual), DNS servers, and other advanced options.
NetworkManager TUI
In addition to the graphical tool, Fedora also provides a text-based user interface (TUI) for NetworkManager, which allows you to configure network settings from the command line.
- Open a terminal window.
- Run the command
nmtui
to launch the NetworkManager TUI. - Use the arrow keys and
Enter
key to navigate through the various options and configure your network connections.
Command-Line Network Configuration
For more advanced or scripted network configuration, Fedora provides several command-line utilities.
NetworkManager Command-Line Tool
NetworkManager is the default network management tool in Fedora. You can use the nmcli
command-line tool to manage network connections and settings.
Configuring Wired Connection
- Open a terminal window.
- To list available wired connections, run
nmcli device status
. - To connect to a wired connection, run
nmcli connection up <connection-name>
, replacing<connection-name>
with the name of your wired connection. - To modify the connection settings, run
nmcli connection modify <connection-name> <setting>.<property> <value>
, replacing<connection-name>
,<setting>
,<property>
, and<value>
with the appropriate values for your connection.
Configuring Wireless Connection
- Open a terminal window.
- To list available wireless networks, run
nmcli device wifi list
. - To connect to a wireless network, run
nmcli device wifi connect <ssid> password <password>
, replacing<ssid>
with the name of the wireless network and<password>
with the network password (if required). - To modify the wireless connection settings, use the
nmcli connection modify
command, as described in the wired connection section.
Configuring DNS Settings
- Open a terminal window.
- To view the current DNS settings, run
nmcli connection show <connection-name>
. - To modify the DNS settings, run
nmcli connection modify <connection-name> ipv4.dns "<dns1>,<dns2>"
ornmcli connection modify <connection-name> ipv6.dns "<dns1>,<dns2>"
, replacing<connection-name>
,<dns1>
, and<dns2>
with the appropriate values.
Managing Network Interfaces
- Open a terminal window.
- To list all available network interfaces, run
ip link show
. - To bring an interface up or down, run
ip link set <interface-name> up
orip link set <interface-name> down
, replacing<interface-name>
with the name of the network interface. - To configure an IP address for an interface, run
ip addr add <ip-address>/<prefix-length> dev <interface-name>
, replacing<ip-address>
,<prefix-length>
, and<interface-name>
with the appropriate values.
Advanced Network Configuration
Fedora provides additional tools and utilities for more advanced network configuration scenarios, such as static IP address configuration, network bonding, network bridging, and virtual private network (VPN) setup.
Static IP Address Configuration
If you need to configure a static IP address instead of using DHCP, you can use the nmcli
command or modify the network configuration files directly.
- Open a terminal window.
- To configure a static IP address using
nmcli
, runnmcli connection modify <connection-name> ipv4.method manual ipv4.addresses "<ip-address>/<prefix-length> <gateway>" ipv4.dns "<dns1>,<dns2>"
, replacing the placeholders with the appropriate values. - Alternatively, you can modify the network configuration files located in
/etc/sysconfig/network-scripts/
or/etc/NetworkManager/system-connections/
.
Network Bonding
Network bonding is a technique used to combine multiple network interfaces into a single logical interface, providing redundancy and increased throughput.
- Install the required package:
sudo dnf install network-scripts-gre
- Create a bond configuration file in
/etc/sysconfig/network-scripts/
, such asifcfg-bond0
. - Configure the bond settings, such as the bonding mode, interfaces to be bonded, and IP address.
- Restart the network service:
sudo systemctl restart network
Network Bridging
Network bridging is used to combine multiple network interfaces into a single virtual network, allowing communication between different network segments.
- Install the required package:
sudo dnf install bridge-utils
- Create a bridge configuration file in
/etc/sysconfig/network-scripts/
, such asifcfg-br0
. - Configure the bridge settings, such as the interfaces to be bridged and IP address.
- Restart the network service:
sudo systemctl restart network
Virtual Private Network (VPN)
Fedora supports various VPN protocols, including OpenVPN, IPsec, and more. You can use the NetworkManager GUI or command-line tools to configure and connect to VPN servers.
- Open the GNOME Settings and navigate to the “Network” section.
- Click on the “+” button in the VPN section and select the desired VPN protocol.
- Enter the VPN server details, such as the server address, username, and password.
- Save the VPN connection and connect to the VPN server.
Alternatively, you can use the nmcli
command-line tool to configure and manage VPN connections.
Troubleshooting Network Issues
If you encounter network issues in Fedora, you can use various tools and utilities to troubleshoot and diagnose the problem.
- Use the
ping
command to test network connectivity:ping <destination-address>
. - Use the
traceroute
command to trace the network path to a destination:traceroute <destination-address>
. - Analyze network traffic using tools like
tcpdump
or `wireshark
4.6 - Package Management
Introduction to DNF
DNF stands for “Dandified YUM” or “DNF Next Generation.” It is a modern and improved version of the YUM package manager, offering better performance, improved dependency handling, and additional features.
DNF is a command-line utility that interacts with the package repositories configured on your Fedora system. These repositories contain various software packages, along with their dependencies and metadata.
Basic DNF Commands
Here are some of the most commonly used DNF commands:
Installing Packages
To install a new package, use the following command:
sudo dnf install package_name
Replace package_name
with the name of the package you want to install.
Removing Packages
To remove an installed package, use the following command:
sudo dnf remove package_name
Updating Packages
To update all installed packages to their latest available versions, run:
sudo dnf update
Upgrading the System
To upgrade your entire Fedora system to the latest available version, use:
sudo dnf upgrade
Searching for Packages
To search for a package in the configured repositories, use:
dnf search keyword
Replace keyword
with the search term you’re looking for.
Listing Installed Packages
To list all installed packages on your system, run:
dnf list installed
Getting Package Information
To get detailed information about a package, use:
dnf info package_name
Cleaning Up
DNF maintains a cache of package metadata and headers. To clear this cache and free up disk space, run:
sudo dnf clean all
Managing Repositories
DNF uses repository files located in the /etc/yum.repos.d/
directory to determine where to look for packages. These files contain information about the repositories, such as the base URL, package groups, and GPG keys for package verification.
To enable or disable a repository, you can edit the corresponding .repo
file in the /etc/yum.repos.d/
directory and set the enabled
option to 1
(enabled) or 0
(disabled).
You can also add new repositories by creating a new .repo
file in the same directory. This is useful when you want to install packages from third-party repositories.
Dependency Management
One of the key strengths of DNF is its ability to handle package dependencies automatically. When you install a package, DNF will automatically resolve and install any required dependencies, ensuring a consistent and functional system.
If a package you’re trying to install has unmet dependencies, DNF will inform you about the missing packages and suggest a solution, such as installing additional packages to satisfy the dependencies.
Additional DNF Features
DNF offers several additional features and options to enhance package management:
- Groups: Packages in Fedora are organized into groups based on their functionality. You can list, install, or remove entire groups of packages using the
dnf groups
command. - History: DNF maintains a history of package transactions, allowing you to review and, if necessary, undo or redo previous actions.
- Plugins: DNF supports various plugins that extend its functionality, such as providing additional information about packages or enabling parallel downloads.
- Configuration: DNF’s behavior can be customized by editing the
/etc/dnf/dnf.conf
configuration file or by using command-line options.
Conclusion
Package management is a crucial aspect of maintaining a Linux system, and DNF is a powerful tool for managing packages in Fedora Linux. By understanding the basic DNF commands, managing repositories, and leveraging its dependency management capabilities, you can keep your Fedora system up-to-date, install new software, and ensure a consistent and functional software environment.
For more advanced usage and a comprehensive list of DNF commands and options, refer to the official DNF documentation or run man dnf
in your terminal.
4.7 - Remote Access and SSH
Introduction to Remote Access
In this section, we’ll explore the fundamentals of remote access, its benefits, and common methods used to establish remote connections.
What is Remote Access?
Remote access refers to the ability to connect to and interact with a computer or network from a remote location. It enables users to perform tasks, access resources, and manage systems without physically being present at the location of the resources.
Benefits of Remote Access
There are several advantages to remote access, including:
Increased Productivity: Remote access allows users to work from anywhere, reducing the need for physical presence at the workplace and enabling flexible work arrangements.
Cost Savings: It reduces the need for physical infrastructure and travel expenses, resulting in cost savings for businesses and individuals.
Enhanced Collaboration: Remote access facilitates collaboration among distributed teams by enabling real-time communication and shared access to resources.
Accessibility: It provides access to resources from any location with an internet connection, promoting inclusivity and accessibility.
Efficient System Management: IT administrators can remotely monitor and manage systems, perform updates, and troubleshoot issues without the need for physical access to hardware.
Common Remote Access Methods
Several methods are commonly used to establish remote connections:
Remote Desktop Protocol (RDP): Allows users to access the desktop interface of a remote computer as if they were physically present at the machine.
Virtual Private Network (VPN): Creates a secure, encrypted connection to a private network over the internet, enabling remote users to access network resources securely.
SSH (Secure Shell): Provides encrypted remote access to command-line interfaces of remote systems, commonly used in Unix-based environments.
Web-based Remote Access Tools: Web-based platforms and tools allow users to remotely access and manage systems through a web browser interface.
Each method has its strengths and use cases, catering to different requirements and preferences of users and organizations.
Introduction to SSH (Secure Shell)
In this section, we’ll delve into the concept of SSH (Secure Shell), its advantages, and its architecture and components.
What is SSH?
SSH, which stands for Secure Shell, is a cryptographic network protocol used for secure remote access and communication between computers. It provides a secure channel over an insecure network, allowing users to securely log in to and execute commands on remote machines.
Advantages of SSH
There are several advantages to using SSH for remote access and communication:
Encryption: SSH encrypts data transmitted between the client and server, ensuring confidentiality and protecting against eavesdropping.
Authentication: SSH provides various authentication methods, including password-based authentication and public-key cryptography, ensuring secure user authentication.
Data Integrity: SSH ensures the integrity of data transmitted over the network, detecting any tampering or modifications.
Portability: SSH is platform-independent and widely supported, making it suitable for various operating systems and devices.
Flexibility: SSH supports various protocols and features, such as tunneling, port forwarding, and file transfer, providing a versatile and flexible communication platform.
SSH Architecture and Components
SSH consists of several components, including:
SSH Client: The client component initiates SSH connections to remote servers, allowing users to remotely access and interact with remote systems.
SSH Server: The server component listens for incoming SSH connections, authenticates clients, and provides access to remote systems.
SSH Protocol: The SSH protocol defines the rules and procedures for secure communication between the client and server, including encryption algorithms, authentication methods, and message formats.
Public-key Cryptography: SSH utilizes public-key cryptography for secure authentication, allowing users to authenticate themselves to the server without transmitting passwords over the network.
SSH’s architecture and components work together to provide a secure and reliable communication platform for remote access and administration.
Here’s the markdown content for the “Installing and Enabling SSH Server on Fedora” section:
Installing and Enabling SSH Server on Fedora
In this section, we’ll walk through the process of installing and enabling the SSH server on Fedora Linux.
Checking if SSH Server is Installed
Before proceeding with the installation, it’s essential to check if the SSH server package is already installed on your Fedora system. You can do this by running the following command in your terminal:
sudo dnf list installed | grep openssh-server
If the SSH server package is installed, you’ll see its information listed in the output. Otherwise, you’ll need to proceed with the installation.
Installing SSH Server
To install the SSH server package on Fedora, you can use the dnf
package manager. Run the following command in your terminal:
sudo dnf install openssh-server
This command will download and install the SSH server package along with any necessary dependencies.
Enabling and Starting the SSH Service
Once the SSH server package is installed, you need to enable and start the SSH service to allow incoming SSH connections. Use the following commands:
sudo systemctl enable sshd
sudo systemctl start sshd
These commands will enable the SSH service to start automatically at boot time and start the SSH server immediately.
Verifying SSH Server Status
To verify that the SSH server is running and accessible, you can use the following command:
sudo systemctl status sshd
This command will display the status of the SSH service, including whether it’s active and any relevant log messages.
Once the SSH server is installed, enabled, and running, you’ll be able to connect to your Fedora system remotely using SSH.
Configuring SSH Server
In this section, we’ll explore the configuration of the SSH server on Fedora Linux, including understanding the SSH configuration file, common configuration options, adjusting the SSH port and listening addresses, and implementing security measures.
Understanding the SSH Configuration File
The SSH server configuration is typically stored in the /etc/ssh/sshd_config
file. This file contains various directives that control the behavior of the SSH server, including authentication methods, access controls, and networking settings.
Common SSH Configuration Options
Some common configuration options that you may want to modify in the sshd_config
file include:
PermitRootLogin: Controls whether root login is allowed. It’s recommended to set this to
no
to enhance security.Port: Specifies the port on which the SSH server listens for incoming connections. The default port is 22, but you may choose to change it for security reasons.
ListenAddress: Defines the IP addresses or network interfaces on which the SSH server listens for connections. You can specify specific addresses or use
0.0.0.0
to listen on all available interfaces.
Adjusting SSH Port and Listening Addresses
To adjust the SSH port and listening addresses, you can edit the sshd_config
file using a text editor such as nano
or vi
. For example, to change the SSH port to 2222
and listen on a specific IP address 192.168.1.100
, you can add or modify the following lines in the configuration file:
Port 2222
ListenAddress 192.168.1.100
Remember to restart the SSH service (sudo systemctl restart sshd
) after making changes to the configuration file for the changes to take effect.
Restricting Root Login and Other Security Measures
To enhance security, it’s recommended to disable root login and implement other security measures such as:
Use SSH Key Authentication: Disable password authentication and use SSH key-based authentication for increased security.
Limit User Access: Configure access controls to limit SSH access to specific users or groups.
Set Idle Timeout: Set an idle timeout to automatically disconnect inactive SSH sessions.
By implementing these security measures and configuring the SSH server according to best practices, you can enhance the security of your Fedora system and protect against unauthorized access.
SSH Client Usage
In this section, we’ll cover the usage of the SSH client on Fedora Linux, including connecting to an SSH server, SSH command options, and authenticating with both passwords and SSH keys.
Connecting to an SSH Server
To connect to an SSH server from your Fedora system, you can use the ssh
command followed by the username and hostname or IP address of the remote server. For example:
ssh username@hostname_or_ip
Replace username
with your username on the remote server and hostname_or_ip
with the hostname or IP address of the SSH server.
SSH Command Options
The ssh
command provides various options to customize the behavior of the SSH client. Some commonly used options include:
-p <port>
: Specifies the port number on which the SSH server is listening. Use this option if the SSH server is running on a non-standard port.-i <identity_file>
: Specifies the path to the private key file for SSH key-based authentication.-l <username>
: Specifies the username to use when connecting to the SSH server. This option is equivalent to specifying the username in the formatusername@hostname
.
You can view all available options and their descriptions by running man ssh
in your terminal.
Authenticating with Passwords
By default, the SSH client will attempt to authenticate using password-based authentication. When prompted, enter the password associated with your username on the remote server to authenticate.
Authenticating with SSH Keys (Key-based Authentication)
SSH key-based authentication offers a more secure method of authentication compared to passwords. To authenticate using SSH keys, follow these steps:
- Generate an SSH key pair on your local machine using the
ssh-keygen
command. - Copy the public key (
~/.ssh/id_rsa.pub
by default) to the~/.ssh/authorized_keys
file on the remote server. - Ensure that the permissions of the
~/.ssh
directory and~/.ssh/authorized_keys
file are set correctly (700
for the directory and600
for the file). - When connecting to the SSH server, the client will automatically use the private key (
~/.ssh/id_rsa
by default) for authentication.
SSH key-based authentication eliminates the need to enter passwords and provides a more secure and convenient method of authentication.
By understanding these concepts and options, you can effectively use the SSH client for remote access and authentication on Fedora Linux.
SSH Key Management
In this section, we’ll explore key management tasks related to SSH, including generating SSH key pairs, copying public keys to remote servers, managing SSH known hosts, and utilizing SSH agents and keychain utilities.
Generating SSH Key Pairs
To generate an SSH key pair on your local machine, you can use the ssh-keygen
command. By default, this command will generate an RSA key pair. Run the following command in your terminal:
ssh-keygen -t rsa
You can also specify a different type of key pair, such as ECDSA or Ed25519, by using the -t
option followed by the desired algorithm.
Copying Public Keys to Remote Servers
After generating an SSH key pair, you’ll need to copy the public key to the ~/.ssh/authorized_keys
file on the remote server to enable key-based authentication. You can use the ssh-copy-id
command to accomplish this. For example:
ssh-copy-id username@hostname_or_ip
Replace username
with your username on the remote server and hostname_or_ip
with the hostname or IP address of the remote server.
Managing SSH Known Hosts
SSH maintains a list of known hosts to verify the authenticity of the remote server when connecting. The list is stored in the ~/.ssh/known_hosts
file. If you encounter warnings about the authenticity of the host, you can remove or edit entries in this file manually.
Using SSH Agents and Keychain Utilities
SSH agents and keychain utilities can help manage SSH keys more conveniently and securely. An SSH agent stores decrypted private keys in memory and provides them to the SSH client when needed, eliminating the need to enter passphrases repeatedly.
To start an SSH agent, you can use the following command:
eval "$(ssh-agent -s)"
You can add your SSH private keys to the agent using the ssh-add
command:
ssh-add ~/.ssh/id_rsa
Keychain utilities, such as ssh-agent
and keychain
, provide additional features for managing SSH keys, including automatic key loading and passphrase caching.
By effectively managing SSH keys and leveraging SSH agents and keychain utilities, you can streamline the authentication process and enhance the security of your SSH connections.
SSH Tunneling and Port Forwarding
In this section, we’ll explore SSH tunneling and port forwarding techniques, including local port forwarding, remote port forwarding, dynamic port forwarding (SOCKS proxy), and practical use cases for SSH tunneling.
Introduction to SSH Tunneling
SSH tunneling, also known as SSH port forwarding, allows you to create secure connections between local and remote systems, forwarding network traffic through encrypted SSH channels.
Local Port Forwarding
Local port forwarding enables you to forward traffic from a local port on your machine to a specific destination host and port on a remote server. This is useful for accessing services running on the remote server through a secure SSH connection.
Remote Port Forwarding
Remote port forwarding works in the opposite direction, forwarding traffic from a remote port on the SSH server to a specific destination host and port on your local machine. This allows external systems to access services running on your local machine through the SSH tunnel.
Dynamic Port Forwarding (SOCKS Proxy)
Dynamic port forwarding sets up a SOCKS proxy server on your local machine, allowing applications to route their traffic through the SSH tunnel. This provides a more flexible and versatile approach to tunneling, as it can be used for various types of network traffic and applications.
Practical Use Cases for SSH Tunneling
SSH tunneling has numerous practical use cases, including:
Secure Remote Access: Accessing remote services securely over an encrypted SSH connection.
Bypassing Firewalls: Circumventing restrictive firewalls or network filters by tunneling traffic through an SSH connection.
Secure File Transfer: Transferring files securely between systems using SCP or SFTP over an SSH tunnel.
Secure Web Browsing: Routing web browser traffic through a SOCKS proxy server created via SSH dynamic port forwarding for enhanced privacy and security.
By leveraging SSH tunneling and port forwarding techniques, you can establish secure communication channels and overcome network restrictions effectively.
SSH Advanced Topics
In this section, we’ll delve into advanced topics related to SSH, including compression and performance tuning, multiplexing and connection sharing, using SSH with configuration management tools, and SSH hardening and security best practices.
SSH Compression and Performance Tuning
SSH supports compression to reduce the amount of data transferred over the network, which can improve performance, especially on slower connections. You can enable compression by adding the Compression
directive to the SSH configuration file (sshd_config
for the server and ssh_config
for the client).
SSH Multiplexing and Connection Sharing
SSH multiplexing allows multiple SSH sessions to share a single TCP connection, reducing overhead and improving performance. This can be achieved by enabling SSH multiplexing in the SSH configuration files (sshd_config
and ssh_config
) and using the ControlMaster
and ControlPath
directives.
Using SSH with Configuration Management Tools
SSH is commonly used as a transport mechanism for configuration management tools like Ansible, Puppet, and Chef. These tools leverage SSH to securely communicate with remote systems and manage their configurations. You can configure these tools to use SSH for authentication and data transfer by specifying SSH-related parameters in their configuration files.
SSH Hardening and Security Best Practices
To enhance the security of SSH connections, it’s important to follow security best practices and hardening techniques. Some recommended practices include:
Disable SSH Protocol 1: SSH protocol version 1 is outdated and insecure. It’s recommended to disable support for SSH protocol version 1 in the SSH server configuration (
sshd_config
).Use Strong Encryption Algorithms: Configure the SSH server to use strong encryption algorithms and key exchange methods to protect against eavesdropping and brute-force attacks.
Implement Two-Factor Authentication: Enhance authentication security by implementing two-factor authentication (2FA) for SSH logins, requiring users to provide an additional form of verification in addition to their password or SSH key.
By implementing these advanced topics and following security best practices, you can optimize the performance and security of your SSH connections.
Troubleshooting and Debugging SSH
In this section, we’ll explore common issues that may arise when using SSH and techniques for troubleshooting and debugging SSH connections.
Common SSH Connection Issues
Some common SSH connection issues include:
Connection Refused: Occurs when the SSH server is not running or is unreachable.
Permission Denied (Publickey): Indicates an authentication failure due to incorrect SSH keys or permissions.
Timeout: Occurs when the SSH client fails to establish a connection within the specified timeout period.
Debugging SSH with Verbose Logging
To diagnose SSH connection issues, you can enable verbose logging using the -v
option with the ssh
command. For example:
ssh -v username@hostname
This command will display detailed debugging information, including the SSH negotiation process and any errors encountered during connection establishment.
SSH Client and Server Log Files
SSH client and server log files can provide valuable information for troubleshooting. Common log file locations include:
SSH Client Logs:
/var/log/auth.log
(on Debian-based systems) or/var/log/secure
(on Red Hat-based systems).SSH Server Logs:
/var/log/sshd.log
or/var/log/auth.log
(on most systems).
Inspecting these log files can help identify connection issues, authentication failures, and other errors encountered during SSH sessions.
Troubleshooting SSH Key Authentication Issues
If you encounter SSH key authentication issues, ensure that:
The correct public key is added to the
~/.ssh/authorized_keys
file on the remote server.The permissions of the
~/.ssh
directory and~/.ssh/authorized_keys
file are set to700
and600
, respectively.The private key file (
~/.ssh/id_rsa
or~/.ssh/id_dsa
) on the client machine is not accessible by others and has the correct permissions (600
).
By understanding common SSH connection issues, utilizing verbose logging, examining log files, and troubleshooting SSH key authentication problems, you can effectively diagnose and resolve SSH-related issues.
Conclusion and Additional Resources
In conclusion, this tutorial has provided a comprehensive overview of SSH and its usage on Fedora Linux for remote access and communication. Let’s recap the key points covered in this tutorial:
We introduced the concept of SSH (Secure Shell) and its advantages for secure remote access and communication.
We discussed how to install and enable the SSH server on Fedora Linux, along with configuring various options for enhanced security and performance.
We explored SSH client usage, including connecting to SSH servers, using SSH command options, and authenticating with passwords and SSH keys.
We covered SSH key management tasks such as generating SSH key pairs, copying public keys to remote servers, and using SSH agents and keychain utilities.
We delved into advanced topics including SSH tunneling and port forwarding, SSH multiplexing and connection sharing, and using SSH with configuration management tools.
We provided troubleshooting and debugging techniques for common SSH connection issues, including verbose logging and examining log files.
Further Reading and References
For further exploration of SSH and related topics, you may find the following resources helpful:
OpenSSH Documentation: Official documentation for OpenSSH, the implementation of SSH used in most Linux distributions.
SSH.com Documentation: Documentation and guides for SSH, including tutorials, best practices, and security advisories.
Fedora Documentation: Official documentation for Fedora Linux, including guides and tutorials on various topics related to Fedora and Linux in general.
By leveraging the knowledge and techniques presented in this tutorial, you can effectively utilize SSH for remote access and communication on Fedora Linux, while ensuring security and efficiency in your workflow.
Throughout the tutorial, I’ll provide detailed explanations, practical examples, and step-by-step instructions for each topic. We’ll cover both the theoretical concepts and hands-on techniques to help you become proficient in using SSH for remote access on Fedora Linux.
4.8 - System Backup and Restore
Introduction to System Backups
A system backup is a complete copy of your operating system, applications, configurations, and user data. It serves as a safeguard against data loss, system failures, or accidental deletions. Having a reliable backup strategy in place is essential for any Linux user, whether you’re a home user, developer, or system administrator.
In this tutorial, we will cover various methods for creating system backups on Fedora Linux, including built-in tools like rsync
and tar
, as well as third-party solutions like Timeshift, Borg Backup, and Duplicity. Each tool has its own strengths and weaknesses, catering to different use cases and preferences.
Built-in Backup Tools
Fedora Linux comes pre-installed with several powerful backup tools that can be utilized for creating system backups. Let’s explore two of the most commonly used tools: rsync
and tar
.
Rsync
rsync
(Remote Sync) is a versatile command-line utility that can efficiently copy and synchronize files and directories locally or over a network. It is particularly useful for creating incremental backups, where only the changes since the last backup are copied, saving time and storage space.
Creating a Backup with Rsync
To create a backup using rsync
, follow these steps:
Open a terminal.
Navigate to the directory where you want to store your backup. For example, if you want to backup your entire root directory (
/
) to an external hard drive mounted at/media/backup_drive
, run:cd /media/backup_drive
Run the
rsync
command with the appropriate options. For a full system backup, you can use the following command:sudo rsync -aAXv --delete --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} / /media/backup_drive/system_backup
Here’s what each option means:
-a
: Archive mode (preserves permissions, ownership, and symbolic links)-A
: Preserves ACLs (Access Control Lists)-X
: Preserves extended file attributes-v
: Verbose output (shows the files being copied)--delete
: Deletes files in the destination that are not present in the source--exclude
: Excludes specific directories from being copied (e.g.,/dev
,/proc
,/sys
,/tmp
,/run
,/mnt
,/media
,/lost+found
)
This command will create a directory called
system_backup
inside the/media/backup_drive
directory and copy the entire root filesystem (/
) to it, excluding the specified directories.Wait for the backup process to complete. The duration will depend on the size of your system and the speed of your storage devices.
Scheduling Rsync Backups
To automate the backup process, you can create a cron job that runs the rsync
command at a specified interval. Here’s an example of how to create a cron job that runs a daily backup at 3 AM:
Open a text editor and create a new file with the cron job:
sudo nano /etc/cron.daily/system_backup
Add the following lines to the file, replacing
/media/backup_drive
with the path to your external hard drive:#!/bin/bash rsync -aAXv --delete --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} / /media/backup_drive/system_backup
Save the file and exit the text editor.
Make the script executable:
sudo chmod +x /etc/cron.daily/system_backup
Now, your system will be backed up daily at 3 AM to the specified location. You can adjust the schedule and backup location as needed.
Tar
tar
(Tape Archiver) is another built-in command-line utility in Linux for creating compressed archive files. While rsync
is ideal for incremental backups, tar
is more suitable for creating full system backups in a single archive file.
Creating a Backup with Tar
To create a backup using tar
, follow these steps:
Open a terminal.
Navigate to the directory where you want to store your backup. For example, if you want to backup your entire root directory (
/
) to an external hard drive mounted at/media/backup_drive
, run:cd /media/backup_drive
Run the
tar
command with the appropriate options. For a full system backup, you can use the following command:sudo tar -cvpzf system_backup.tar.gz --exclude=/system_backup.tar.gz --one-file-system /
Here’s what each option means:
-c
: Creates a new archive-v
: Verbose output (shows the files being archived)-p
: Preserves permissions-z
: Compresses the archive using gzip-f
: Specifies the file name for the archive (system_backup.tar.gz
)--exclude
: Excludes the backup archive file itself from being included in the backup--one-file-system
: Avoids backing up data from other mounted filesystems
This command will create a compressed archive file called
system_backup.tar.gz
inside the/media/backup_drive
directory, containing the entire root filesystem (/
).Wait for the backup process to complete. The duration will depend on the size of your system and the speed of your storage devices.
Scheduling Tar Backups
Similar to rsync
, you can create a cron job to automate the backup process with tar
. Here’s an example of how to create a cron job that runs a daily backup at 3 AM:
Open a text editor and create a new file with the cron job:
sudo nano /etc/cron.daily/system_backup
Add the following lines to the file, replacing
/media/backup_drive
with the path to your external hard drive:#!/bin/bash cd /media/backup_drive tar -cvpzf system_backup.tar.gz --exclude=/system_backup.tar.gz --one-file-system /
Save the file and exit the text editor.
Make the script executable:
sudo chmod +x /etc/cron.daily/system_backup
Now, your system will be backed up daily at 3 AM to the specified location. You can adjust the schedule and backup location as needed.
Third-Party Backup Solutions
While the built-in tools like rsync
and tar
are powerful and versatile, there are several third-party backup solutions available that offer additional features and user-friendly interfaces. In this section
4.9 - System Logging and Log Analysis
journalctl
, and how to analyze logs for troubleshooting purposes.Understanding the systemd Journal
The systemd journal is a centralized logging system that stores log data in a binary format, making it more efficient and reliable than traditional text-based log files. The journal collects log entries from various components of the system, including the kernel, system services, and user applications. Each log entry contains metadata such as timestamps, source, and priority level, making it easier to filter and analyze log data.
Viewing Log Entries with journalctl
The journalctl
command is the primary tool for interacting with the systemd journal. It allows you to view, filter, and manage log entries. Here are some common use cases:
Viewing the Latest Log Entries
To view the latest log entries, simply run journalctl
without any additional arguments:
journalctl
This command will display the most recent log entries from all sources.
Filtering Log Entries by Service or Process
You can filter log entries by service or process using the -u
option. For example, to view log entries related to the sshd
service, run:
journalctl -u sshd
Filtering Log Entries by Time Range
The journalctl
command allows you to filter log entries by time range using the --since
and --until
options. For example, to view log entries from the last 24 hours, run:
journalctl --since=24h
You can also specify a specific date and time range using the format YYYY-MM-DD HH:MM:SS
. For example:
journalctl --since="2023-04-01 00:00:00" --until="2023-04-02 12:00:00"
Filtering Log Entries by Priority Level
Log entries are assigned priority levels ranging from emerg
(highest priority) to debug
(lowest priority). You can filter log entries by priority level using the -p
option. For example, to view log entries with a priority level of error
or higher, run:
journalctl -p err
Following Log Entries in Real-Time
You can use the -f
option to follow log entries in real-time, similar to the tail -f
command for traditional log files:
journalctl -f
This command will continuously display new log entries as they are generated, making it useful for monitoring system activities or troubleshooting issues.
Analyzing Log Entries
In addition to viewing and filtering log entries, you can also analyze log data using various tools and techniques. Here are some common approaches:
Searching Log Entries
You can search for specific patterns or keywords within log entries using the grep
command in combination with journalctl
. For example, to search for log entries containing the word “error”, run:
journalctl | grep -i error
The -i
option makes the search case-insensitive.
Identifying Patterns and Trends
When troubleshooting issues, it can be helpful to identify patterns or trends in log entries. You can use tools like awk
or sed
to extract and analyze specific fields or data from log entries. For example, to count the number of occurrences of each unique message in the log, you can use the following command:
journalctl | awk '{print $NF}' | sort | uniq -c | sort -n
This command extracts the last field (typically the log message) from each log entry, sorts the messages, counts the occurrences of each unique message, and finally sorts the output by the count.
Persisting Log Entries
While the systemd journal stores log entries in a binary format, you can persist log entries to traditional text files for archiving or analysis purposes. To export log entries to a text file, use the --output
option with journalctl
:
journalctl --output=short-precise > /path/to/logfile.txt
The --output
option specifies the format of the exported log entries, with short-precise
being a commonly used format that includes timestamps, source, and log messages.
Conclusion
Managing and analyzing system logs is a crucial task for system administrators and troubleshooters. Fedora Linux’s systemd journal provides a powerful and efficient logging system, while journalctl
and various other tools enable you to view, filter, and analyze log data effectively. By understanding the techniques covered in this tutorial, you can gain valuable insights into your system’s behavior, identify potential issues, and take proactive measures to maintain a stable and secure environment.
4.10 - System Monitoring with systemd
Prerequisites
This tutorial assumes that you have a Fedora Linux system with systemd installed and configured. Additionally, you should have a basic understanding of the Linux command line and file system.
Monitoring System Resources
systemd provides several utilities to monitor system resources, including CPU, memory, and disk usage.
Monitoring CPU Usage
To monitor CPU usage, you can use the systemd-cgtop
command, which displays a live view of the CPU usage for all running processes and services.
$ systemd-cgtop
This command provides a top-like interface, showing the CPU usage for each process or service, as well as the overall CPU usage for the system.
Monitoring Memory Usage
To monitor memory usage, you can use the systemd-cgtop
command with the -m
or --order=memory
option to sort the output by memory usage.
$ systemd-cgtop -m
Alternatively, you can use the systemd-cgls
command to list all control groups (cgroups) and their memory usage.
$ systemd-cgls -m
This command shows the memory usage for each cgroup, including the total memory usage, as well as the usage of various memory types (e.g., RSS, cache, swap).
Monitoring Disk Usage
To monitor disk usage, you can use the systemd-cgtop
command with the -d
or --order=disk
option to sort the output by disk usage.
$ systemd-cgtop -d
This command displays the disk usage for each process or service, as well as the overall disk usage for the system.
Monitoring System Services
systemd provides several utilities to monitor and manage system services.
Listing Services
To list all available system services, you can use the systemctl
command with the list-unit-files
option.
$ systemctl list-unit-files
This command displays a list of all service units, along with their status (enabled or disabled).
Checking Service Status
To check the status of a specific service, you can use the systemctl
command with the status
option, followed by the service name.
$ systemctl status <service_name>
For example, to check the status of the Apache web server service:
$ systemctl status httpd
This command displays detailed information about the service, including its current status (active, inactive, or failed), the process ID (PID), and any recent log entries.
Starting, Stopping, and Restarting Services
You can use the systemctl
command to start, stop, or restart a service.
- To start a service:
$ systemctl start <service_name>
- To stop a service:
$ systemctl stop <service_name>
- To restart a service:
$ systemctl restart <service_name>
Enabling and Disabling Services
To ensure that a service starts automatically at system boot, you can enable it using the systemctl
command with the enable
option.
$ systemctl enable <service_name>
To disable a service and prevent it from starting automatically at boot, use the disable
option.
$ systemctl disable <service_name>
Monitoring Processes
In addition to monitoring system resources and services, systemd provides utilities for monitoring processes.
Listing Running Processes
To list all running processes, you can use the systemd-cgls
command with the -p
or --cgroup
option.
$ systemd-cgls -p
This command displays a list of all running processes, along with their respective cgroups and resource usage.
Monitoring Process Resource Usage
To monitor the resource usage of a specific process, you can use the systemd-cgtop
command with the -a
or --all
option to display all processes, or with the -p
or --print-pids
option to specify the process ID (PID) or name.
$ systemd-cgtop -a
$ systemd-cgtop -p <pid>
$ systemd-cgtop -p <process_name>
This command provides a live view of the resource usage for the specified process or processes, including CPU, memory, and disk usage.
System Logging
systemd provides a powerful logging system called the Journal, which collects and manages log data from various system components, including services and processes.
Viewing System Logs
To view the system logs, you can use the journalctl
command.
$ journalctl
This command displays the entire log history, starting from the oldest entry.
You can use various options with journalctl
to filter and format the log output. For example:
- To display the log entries for a specific service:
$ journalctl -u <service_name>
- To display the log entries for a specific process:
$ journalctl -p _PID=<pid>
- To display the log entries for a specific time range:
$ journalctl --since="YYYY-MM-DD HH:MM:SS" --until="YYYY-MM-DD HH:MM:SS"
- To display the log entries in a specific format (e.g., JSON, short, verbose):
$ journalctl -o <format>
Clearing System Logs
In some cases, you may need to clear the system logs to free up disk space or for troubleshooting purposes.
To clear the system logs, you can use the journalctl
command with the --vacuum-size
option, followed by the desired size limit.
$ journalctl --vacuum-size=<size>
For example, to limit the log size to 100 MB:
$ journalctl --vacuum-size=100M
This command will remove the oldest log entries until the total log size is below the specified limit.
Conclusion
systemd provides a comprehensive set of utilities for monitoring and managing system resources, services, processes, and logs on Fedora Linux. By leveraging these tools, you can gain valuable insights into your system’s performance, troubleshoot issues, and optimize resource usage. This tutorial has covered the most essential systemd utilities for system monitoring, but there are many more advanced features and options available for exploration.
4.11 - System Performance Tuning
Introduction
System performance tuning is the process of adjusting various system components and configurations to optimize the overall performance of your computer. This process can involve tweaking settings related to disk usage, memory management, CPU usage, and networking, among others.
It’s important to note that performance tuning is a complex topic, and the techniques discussed in this tutorial may not be suitable for all systems or use cases. It’s recommended to thoroughly understand the implications of each change and to perform thorough testing before implementing any changes in a production environment.
Disk Usage Optimization
Disk performance plays a crucial role in overall system performance, as it affects file access times and data transfer rates. Here are some techniques to optimize disk usage on your Fedora system.
Monitoring Disk Usage
Before attempting any disk optimization, it’s essential to understand your system’s current disk usage patterns. You can use the following tools to monitor disk usage:
df
(Disk Free): This command displays the amount of available disk space on mounted file systems.du
(Disk Usage): This command shows the disk usage of files and directories.iotop
: This tool displays real-time disk I/O statistics and can help identify processes that are causing high disk activity.
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/nvme0n1p3 50G 12G 36G 25% /
/dev/nvme0n1p1 976M 280M 637M 31% /boot
$ du -sh /var/log
1.2G /var/log
Identifying and Removing Unnecessary Files
Over time, your system can accumulate unnecessary files, such as old log files, temporary files, and package caches. Removing these files can free up disk space and potentially improve performance. However, be cautious when deleting system files, as it may cause issues if done incorrectly.
You can use the following commands to identify and remove unnecessary files:
# Clear package cache
sudo dnf clean all
# Remove old kernel versions (keep the current and one previous version)
sudo package-cleanup --oldkernels --count=2 --verbose
# Remove old log files
sudo journalctl --vacuum-size=500M
Enabling Disk Caching
Disk caching can significantly improve read and write performance by storing frequently accessed data in memory. On Fedora, you can enable disk caching using the vm.vfs_cache_pressure
kernel parameter.
To adjust the vm.vfs_cache_pressure
value, open the /etc/sysctl.conf
file and add the following line:
vm.vfs_cache_pressure=50
This sets the cache pressure to 50, which means the kernel will cache more data in memory. Higher values (up to 100) increase the cache size, potentially improving performance but also consuming more memory.
After making the change, run the following command to apply the new setting:
sudo sysctl -p
Optimizing File System
The choice of file system can also affect disk performance. Fedora uses the XFS file system by default, which is generally considered a high-performance and scalable file system. However, in some cases, you may want to consider using alternative file systems like ext4 or btrfs, depending on your specific needs and workloads.
To check the file system type of a mounted partition, use the df -T
command:
$ df -T
Filesystem Type 1K-blocks Used Available Use% Mounted on
/dev/nvme0n1p3 xfs 51475204 9212592 42262612 18% /
If you decide to change the file system, you’ll need to back up your data, create a new partition with the desired file system, and restore the data. This process can be complex and should be carefully planned and executed.
Memory Management
Effective memory management is crucial for overall system performance, as it affects the responsiveness of applications and the ability to handle multiple tasks simultaneously.
Monitoring Memory Usage
Before optimizing memory usage, it’s essential to understand how your system is currently utilizing memory. You can use the following tools to monitor memory usage:
free
: This command displays the total amount of free and used memory in the system.vmstat
: This tool provides detailed information about memory usage, including virtual memory statistics.top
orhtop
: These interactive process viewers show the memory usage of running processes, allowing you to identify memory-intensive applications.
$ free -h
total used free shared buff/cache available
Mem: 7.8G 1.2G 5.6G 9.0M 1.0G 6.3G
Swap: 2.0G 0B 2.0G
Adjusting Swappiness
The Linux kernel uses a “swappiness” value to determine how aggressively it should swap out inactive processes from memory to disk. A higher swappiness value means the kernel will swap more aggressively, while a lower value means the kernel will try to keep more processes in memory.
In most cases, the default swappiness value of 60 works well. However, if you have a system with a lot of available RAM and want to minimize disk swapping, you can lower the swappiness value. On the other hand, if you have a system with limited RAM and want to free up memory more aggressively, you can increase the swappiness value.
To adjust the swappiness value, open the /etc/sysctl.conf
file and add the following line:
vm.swappiness=10
This sets the swappiness value to 10, which is a relatively low value that will minimize disk swapping. After making the change, run the following command to apply the new setting:
sudo sysctl -p
Enabling Zram
Zram (Compressed RAM) is a kernel module that creates a compressed block device in memory, which can be used as a swap device or a compressed cache for certain workloads. Enabling Zram can improve system performance by reducing disk swapping and improving responsiveness, especially on systems with limited RAM.
To enable Zram on Fedora, follow these steps:
Install the required packages:
sudo dnf install zram-generator
Enable and start the
zram-generator
service:sudo systemctl enable --now zram-generator
Verify that the Zram device is active:
$ cat /proc/swaps Filename Type Size Used Priority /dev/zram0 partition 2097148 0 5
By default, Zram will allocate up to 50% of your system’s RAM for the compressed block device. If you need to adjust this value, you
4.12 - System Security Best Practices
1. User Authentication
1.1 Strong Password Policies
Implement strong password policies to prevent brute-force attacks and unauthorized access. Here are some recommendations:
- Set a minimum password length (e.g., 12 characters)
- Require a combination of uppercase, lowercase, numbers, and special characters
- Enable password aging and expiration policies
- Disable password reuse
To configure password policies, edit the /etc/security/pwquality.conf
file and modify the relevant settings.
1.2 Restrict Root Access
Avoid using the root account for daily tasks, as it grants unrestricted access to the system. Instead, create non-privileged user accounts and use sudo
to perform administrative tasks when necessary.
To configure sudo
access, edit the /etc/sudoers
file using the visudo
command. Here, you can specify which users or groups are allowed to run specific commands with elevated privileges.
1.3 Enable Multi-Factor Authentication (MFA)
Implement multi-factor authentication (MFA) for an additional layer of security. MFA requires users to provide a second form of authentication, such as a one-time password (OTP) or a hardware token, in addition to their regular password.
There are various solutions for enabling MFA on Fedora, such as Google Authenticator or YubiKey.
2. File Permissions
2.1 Principle of Least Privilege
Apply the principle of least privilege to file permissions. This means granting users and processes only the minimum permissions necessary to perform their intended tasks. Regularly audit and adjust file permissions to ensure they are not unnecessarily permissive.
2.2 Restrict Access to Sensitive Files
Sensitive files, such as configuration files, logs, and private data, should have restricted access permissions. Use commands like chmod
, chown
, and chgrp
to set appropriate permissions and ownership.
For example, to restrict access to a sensitive file (/etc/shadow
) to the root user only, you can use the following command:
chmod 600 /etc/shadow
2.3 Disable Unnecessary Services
Disable or remove unnecessary services and daemons to reduce the attack surface. Only enable services that are strictly required for your system’s intended purpose.
You can use the systemctl
command to list, enable, disable, or stop services. For example, to disable the cups
service (Common UNIX Printing System), you can run:
systemctl disable cups
3. System Hardening
3.1 Keep the System Up-to-Date
Regularly update your Fedora system with the latest security patches and software updates. This helps mitigate known vulnerabilities and protect against potential exploits.
Use the dnf
package manager to update your system:
sudo dnf update
3.2 Enable Firewall
Enable the firewall to control incoming and outgoing network traffic. Fedora comes with the firewalld
service, which provides a dynamic firewall management solution.
To enable the firewall, run:
sudo systemctl enable firewalld
sudo systemctl start firewalld
You can then use the firewall-cmd
utility to configure firewall rules and open or close ports as needed.
3.3 Secure SSH Access
If you use SSH for remote access, configure it securely by following these best practices:
- Disable root login over SSH
- Use SSH keys instead of passwords for authentication
- Set a stronger ciphers and key exchange algorithms
- Limit access to specific users or IP addresses
Edit the /etc/ssh/sshd_config
file to customize SSH settings according to your security requirements.
3.4 Enable Auditing and Logging
Enable system auditing and logging to monitor and track system events, user activities, and potential security incidents. Fedora uses the auditd
service for auditing and rsyslog
for logging.
Regularly review audit logs and system logs for any suspicious or unauthorized activities.
3.5 Implement SELinux
SELinux (Security-Enhanced Linux) is a mandatory access control system that enforces security policies on processes, files, and resources. It provides an additional layer of security by restricting what actions a process can perform, even if the user has root privileges.
Fedora comes with SELinux enabled by default, but you should ensure it is configured according to your security requirements. You can use the sestatus
command to check the current SELinux status and the semanage
utility to manage SELinux policies.
4. Additional Security Measures
4.1 Secure Network Services
If you are running network services like web servers, databases, or mail servers, ensure they are configured securely. Follow best practices specific to each service, such as enabling encryption, disabling unnecessary modules, and limiting access.
4.2 Implement Intrusion Detection/Prevention Systems
Consider implementing an Intrusion Detection System (IDS) or Intrusion Prevention System (IPS) to monitor network traffic and system activities for potential threats or malicious activities. Popular IDS/IPS solutions for Linux include Snort, Suricata, and OSSEC.
4.3 Perform Regular Security Audits
Regularly perform security audits to identify and address potential vulnerabilities in your Fedora system. This can include vulnerability scanning, penetration testing, and reviewing system configurations and logs.
4.4 Follow Security Best Practices
Stay up-to-date with the latest security best practices and guidelines from trusted sources, such as the Fedora Project, Red Hat, and industry-recognized security organizations.
Conclusion
Implementing these system security best practices can significantly enhance the security of your Fedora Linux installation. However, it’s important to note that security is an ongoing process, and you should regularly review and update your security measures to stay ahead of emerging threats and vulnerabilities.
Remember to always back up your system and data before making any significant changes, and consult official documentation or seek professional assistance if you are unsure about any security configuration or implementation.
4.13 - System Updates and Patch Management
Understanding Software Updates
Software updates are released for various reasons, including:
- Security Patches: These updates address known security vulnerabilities and are critical for protecting your system against potential threats.
- Bug Fixes: Updates often include fixes for identified software bugs, improving stability and performance.
- Feature Enhancements: New features and improvements are introduced through software updates.
Regularly applying updates ensures that your system remains secure, stable, and up-to-date with the latest features and improvements.
Checking for Available Updates
Before applying any updates, it’s essential to check for available updates on your Fedora system. You can do this using the DNF package manager:
sudo dnf check-update
This command will display a list of available updates without actually installing them. If there are no updates available, you’ll see a message indicating that your system is up-to-date.
Updating Your System
To update your Fedora system with the latest software packages, use the following command:
sudo dnf upgrade
This command will download and install all available updates for your installed packages. It’s recommended to run this command periodically (e.g., weekly or monthly) to ensure your system remains up-to-date.
During the update process, DNF will display information about the packages being updated, including their version numbers and package sizes. You may be prompted to confirm certain actions, such as importing new GPG keys or accepting licensing agreements.
Scheduling Automatic Updates
While manually updating your system is a good practice, Fedora also provides a convenient way to automate the update process. The dnf-automatic
package is a tool that can be configured to automatically download and install updates on a scheduled basis.
To install dnf-automatic
, run the following command:
sudo dnf install dnf-automatic
After installation, you can configure dnf-automatic
by editing the /etc/dnf/automatic.conf
file. This file contains various options that control the behavior of automatic updates.
Here are some commonly used options:
apply_updates
: Set this option toyes
to automatically install updates after downloading them.emit_via
: Specify how you want to receive notifications about updates (e.g.,motd
,email
,systemd-updates
).upgrade_type
: Determine the types of updates to apply (default
,security
,bugfix
, etc.).randomwait
: Set a maximum number of minutes to randomly wait before downloading updates, to avoid overloading servers.
After configuring the automatic.conf
file, you can enable and start the dnf-automatic.timer
systemd timer with the following commands:
sudo systemctl enable dnf-automatic.timer
sudo systemctl start dnf-automatic.timer
This will ensure that dnf-automatic
runs periodically according to your configuration to check for and apply updates.
Managing Kernel Updates
Fedora releases new kernel versions regularly, which are usually installed automatically as part of the system updates. However, after a kernel update, you’ll notice multiple kernel versions listed when running the following command:
sudo dnf list installed | grep kernel
To keep your system clean and avoid potential issues, it’s recommended to remove older kernel versions that you no longer need. You can do this by running the following command:
sudo dnf remove kernel-VERSION
Replace VERSION
with the specific kernel version you want to remove. Be cautious and do not remove the currently running kernel version.
Best Practices
Here are some best practices to follow when managing system updates and patches on Fedora Linux:
- Regularly Check for Updates: Make it a habit to check for available updates periodically, either manually or by setting up automatic updates.
- Read Update Descriptions: Before applying updates, review the update descriptions to understand the changes being introduced and any potential impact on your system.
- Create System Backups: It’s always a good idea to create backups of your system and important data before applying major updates or patches, in case any issues arise during the update process.
- Test Updates in a Non-Production Environment: If you’re managing servers or mission-critical systems, consider testing updates in a non-production environment before deploying them to production systems.
- Monitor System Logs: After applying updates, monitor your system logs for any error messages or warnings that may indicate issues related to the updates.
- Keep Documentation Updated: If you manage multiple systems, maintain documentation or a centralized repository for tracking applied updates and any associated configuration changes.
By following these best practices, you can ensure that your Fedora Linux system remains secure, stable, and up-to-date with the latest software patches and security updates.
4.14 - User Management
Creating a New User Account
To create a new user account in Fedora, use the useradd
command. The basic syntax is:
sudo useradd [options] username
Here are some common options:
-c "Comment"
: Adds a comment or description for the user.-d /home/directory
: Specifies the user’s home directory (default is/home/username
).-g group
: Sets the primary group for the user.-G groups
: Adds the user to supplementary groups.-s shell
: Specifies the user’s login shell (default is/bin/bash
).
Example:
sudo useradd -c "John Doe" -m johndoe
This command creates a new user account named “johndoe” with a comment “John Doe” and creates a home directory /home/johndoe
.
Setting a Password for a User
After creating a user account, you need to set a password for the user. Use the passwd
command:
sudo passwd username
You will be prompted to enter and confirm the new password.
Modifying an Existing User Account
To modify an existing user account, use the usermod
command. The syntax is similar to useradd
:
sudo usermod [options] username
Some common options include:
-c "Comment"
: Changes the user’s comment or description.-d /home/directory
: Changes the user’s home directory.-g group
: Changes the user’s primary group.-G groups
: Adds or removes the user from supplementary groups.-l new_username
: Changes the user’s login name.-L
: Locks the user account (prevents login).-U
: Unlocks the user account.
Example:
sudo usermod -c "John A. Doe" -G developers johndoe
This command changes the comment for the user “johndoe” to “John A. Doe” and adds the user to the “developers” group.
Deleting a User Account
To delete a user account, use the userdel
command:
sudo userdel [options] username
Common options include:
-r
: Removes the user’s home directory and mail spool.-f
: Forces the removal of the user account, even if the user is currently logged in.
Example:
sudo userdel -r johndoe
This command removes the user account “johndoe” and the associated home directory.
User Groups
In addition to managing individual user accounts, Fedora Linux allows you to organize users into groups for better permission management and collaboration.
Creating a New Group
To create a new group, use the groupadd
command:
sudo groupadd groupname
Example:
sudo groupadd developers
This command creates a new group named “developers”.
Adding Users to a Group
To add an existing user to a group, use the usermod
command with the -G
option:
sudo usermod -aG groupname username
The -a
option appends the user to the specified group without removing them from their existing groups.
Example:
sudo usermod -aG developers johndoe
This command adds the user “johndoe” to the “developers” group.
Removing Users from a Group
To remove a user from a group, use the gpasswd
command:
sudo gpasswd -d username groupname
Example:
sudo gpasswd -d johndoe developers
This command removes the user “johndoe” from the “developers” group.
Deleting a Group
To delete an existing group, use the groupdel
command:
sudo groupdel groupname
Example:
sudo groupdel developers
This command deletes the “developers” group from the system.
User Permissions and File Ownership
In Linux, each file and directory has permissions that determine who can read, write, or execute the file or directory. These permissions are controlled by the owner of the file or directory and the associated group.
Changing File and Directory Ownership
To change the owner of a file or directory, use the chown
command:
sudo chown [options] user[:group] file/directory
Common options include:
-R
: Recursively changes ownership for directories and their contents.
Example:
sudo chown johndoe:developers project.txt
This command changes the owner of the file project.txt
to “johndoe” and the group to “developers”.
Changing File and Directory Permissions
To change the permissions of a file or directory, use the chmod
command:
sudo chmod [options] mode file/directory
The mode
parameter specifies the new permissions using symbolic or numeric notation. Common symbolic notations include:
u
(user),g
(group),o
(other)+
(add permission),-
(remove permission),=
(set exact permission)r
(read),w
(write),x
(execute)
Example:
sudo chmod u+x script.sh
This command adds the execute permission for the owner of the file script.sh
.
Numeric notation uses a three-digit octal number, where each digit represents the permissions for the owner, group, and others, respectively. For example:
755
: Owner has read, write, and execute permissions; group and others have read and execute permissions.644
: Owner has read and write permissions; group and others have read permissions.
Example:
sudo chmod 644 project.txt
This command sets the permissions of the file project.txt
to read and write for the owner, and read-only for the group and others.
Conclusion
User management is a critical aspect of system administration in Fedora Linux. This tutorial covered the essential commands and procedures for creating, modifying, and deleting user accounts, managing user groups, and controlling file and directory permissions. By following the best practices outlined in this tutorial, you can ensure secure and efficient user management on your Fedora Linux system.
4.15 - Virtualization with KVM
Introduction to KVM
KVM is a kernel module that provides hardware-assisted virtualization support on x86 hardware with virtualization extensions (Intel VT or AMD-V). It transforms the Linux kernel into a hypervisor, allowing it to run multiple virtual machines securely and efficiently.
KVM has several advantages over other virtualization solutions:
- Performance: KVM provides near-native performance for virtual machines due to hardware-assisted virtualization.
- Open-source: KVM is an open-source solution and part of the Linux kernel, making it free and accessible.
- Integration: KVM is tightly integrated with the Linux kernel, allowing for easy management and monitoring of virtual machines.
- Security: KVM leverages the Linux kernel’s built-in security features, providing a secure and isolated environment for virtual machines.
Installing KVM on Fedora Linux
Before you can use KVM on Fedora Linux, you need to ensure that your system meets the necessary hardware and software requirements.
Hardware Requirements
- A CPU that supports hardware virtualization (Intel VT or AMD-V)
- Sufficient RAM and storage space for the host system and virtual machines
To check if your CPU supports hardware virtualization, run the following command:
egrep -c '(vmx|svm)' /proc/cpuinfo
If the output is greater than 0, your CPU supports hardware virtualization.
Software Requirements
KVM is included in the Fedora Linux distribution by default, but you need to install a few additional packages:
Open a terminal and update the package lists:
sudo dnf update
Install the required packages:
sudo dnf install @virtualization
This command installs the KVM hypervisor, QEMU emulator, and other necessary components.
Verify the installation by checking the KVM module status:
lsmod | grep kvm
You should see output similar to the following, indicating that the KVM module is loaded:
kvm_intel 286720 0 kvm 690176 1 kvm_intel
Congratulations! You have successfully installed KVM on your Fedora Linux system.
Creating a Virtual Machine
Now that you have KVM installed, you can create and manage virtual machines. There are several ways to create and manage VMs with KVM, including command-line tools like virt-manager
and virsh
, as well as graphical tools like the GNOME Boxes application.
In this section, we’ll focus on using the virt-manager
graphical tool, as it provides a user-friendly interface for managing virtual machines.
Install the
virt-manager
package:sudo dnf install virt-manager
Launch the
virt-manager
application from the application menu or by running the following command:virt-manager
In the
virt-manager
window, click on the “Create a new virtual machine” button.Follow the wizard to configure your virtual machine:
- Choose the installation source (ISO image, CDROM, or network install)
- Set the RAM and CPU allocation for the virtual machine
- Configure storage for the virtual machine (disk size and location)
- Customize additional options like network configuration and video settings
Once you’ve completed the wizard, click the “Finish” button to create the virtual machine.
The virtual machine will start, and you can proceed with installing the guest operating system as you would on a physical machine.
During the installation process, you may be prompted to install additional drivers or software for better integration between the host and guest operating systems.
Managing Virtual Machines
After creating your virtual machines, you can manage them using the virt-manager
application or the command-line virsh
tool.
Using virt-manager
The virt-manager
graphical tool provides a user-friendly interface for managing virtual machines. Here are some common tasks you can perform with virt-manager
:
- Start, pause, and stop virtual machines
- View performance metrics like CPU, memory, and disk usage
- Take snapshots of virtual machines for backup or rollback purposes
- Attach additional storage devices or network interfaces
- Configure virtual machine settings like CPU, memory, and device allocation
Using virsh
The virsh
command-line tool provides a more powerful and scriptable way to manage virtual machines. Here are some common virsh
commands:
virsh list
- List all virtual machines and their statesvirsh start <vm-name>
- Start a virtual machinevirsh shutdown <vm-name>
- Gracefully shut down a virtual machinevirsh destroy <vm-name>
- Forcefully stop a virtual machinevirsh undefine <vm-name>
- Remove a virtual machine definition from KVMvirsh edit <vm-name>
- Edit the XML configuration of a virtual machine
You can find more virsh
commands and their usage by running virsh help
or referring to the virsh
manual pages.
Advanced KVM Configuration
While the default KVM configuration works well for most use cases, you may need to customize certain settings for advanced scenarios or specific workloads.
CPU and Memory Allocation
KVM allows you to allocate specific CPU and memory resources to virtual machines. You can configure these settings during virtual machine creation or modify them later using virt-manager
or the virsh
tool.
To modify CPU and memory allocation using virsh
, run the following commands:
# Change CPU allocation
virsh setvcpus <vm-name> <number-of-cpus>
# Change memory allocation
virsh setmaxmem <vm-name> <memory-size>
Replace <vm-name>
with the name of your virtual machine, <number-of-cpus>
with the desired number of CPUs, and <memory-size>
with the desired memory size (e.g., 4096M for 4 GB).
Storage Configuration
KVM supports various storage options, including file-based disk images, physical storage devices (LUNs), and networked storage (iSCSI, NFS). You can configure storage during virtual machine creation or add/remove storage devices later using virt-manager
or virsh
.
To add a new disk to a virtual machine using virsh
, run the following command:
virsh attach-disk <vm-name> <source-path> <target-device> --persistent
Replace <vm-name>
with the name of your virtual machine, <source-path>
with the path to the disk image or device, and <target-device>
with the target device name (e.g., vda, vdb).
Network Configuration
KVM supports various network configurations, including bridged networking, NAT (Network Address Translation), and virtual networks. You can configure network settings during virtual machine creation or modify them later using virt-manager
or virsh
.
To create a new virtual network using virsh
, run the following command:
virsh net-define <network-xml-file>
Replace <network-xml-file>
with the path to an XML file defining your network configuration.
Snapshots and Live Migration
KVM supports taking snapshots of virtual machines, which can be useful for backup or rollback purposes. You can create and manage snapshots using virt-manager
or the virsh
tool.
To create a snapshot of a virtual machine using virsh
, run the following command:
virsh snapshot-create-as <vm-name> <snapshot-name> <description>
Replace <vm-name>
with the name of your virtual machine, <snapshot-name>
with a name for the snapshot,