InterspaceБаза на знаењеТехнички статииНаучиLinux сервер основи за Windows сервер админи
НАУЧИ
01-Март-201901-Јуни-2023
Linux server osnovi za Windows server admini
Sodrzhinata e dostapna samo na angliski jazik.
This guide is for Windows servers admins who want to start using Linux for the first time, with a particular focus on the basics for administering Linux servers through the command-line interface (CLI). It will help you understand Linux fundamentals, drawing parallels to your Windows experience.

1.Choosing a Linux Distro

In the Linux world, distributions or distros are akin to different versions or flavors of the operating system. Each distro is built upon the Linux kernel (the core part of the operating system) but differs in terms of the software and user interface it offers, similar to how various versions of Windows (like Windows Server, Windows 10, Windows 11) have distinct features and interfaces. Here’s a look at some popular distros:

  • Ubuntu: Known for its user-friendliness, Ubuntu is ideal for those new to Linux. It’s comparable to Windows in terms of ease of use and has strong community support.
  • CentOS/RHEL (Red Hat Enterprise Linux): Excellent choices for enterprise environments, offering long-term support and stability. They are akin to Windows Server Datacenter in terms of robustness and advanced features.
  • Debian: Renowned for its stability and reliability, Debian is great for long-term deployments, similar to Windows Long-Term Servicing Channel (LTSC) versions.
  • Fedora: Known for incorporating the latest features, it's excellent for those who want the newest innovations in their Linux experience.
  • openSUSE: Balances between cutting-edge features and stability, suitable for both desktop and server use.
  • Arch Linux: Ideal for experienced users who prefer customizing and building their system from the ground up.

2.User and Group Management

Linux offers a high degree of control and flexibility for managing users and groups. One key aspect of Linux that differs from Windows is the use of sudo for executing commands with elevated privileges.

  • Understanding sudo: In Linux, sudo stands for "superuser do" and is a tool used to run programs with the security privileges of another user, typically the superuser (root). This is comparable to right-clicking and selecting "Run as administrator" in Windows. It is a powerful tool, typically pre-installed on most Linux distros, that ensures administrative commands are executed consciously and securely, reducing the risk of unauthorized system alterations.
  • Creating Users: Use useradd to create a new user. The command sudo useradd -m -s /bin/bash [username] creates a new user with a home directory and bash shell. The sudo here elevates your permissions to execute this administrative task.
  • Managing Groups: The groupadd command creates a new group, and usermod adds users to groups. For instance, sudo usermod -aG [groupname] [username] adds a user to a group
  • Setting Permissions: With chmod and chown, you manage file and directory permissions and ownership. sudo chmod 755 [filename] sets specific read, write, and execute permissions.
  • Password Management: Change user passwords using passwd. The command sudo passwd [username] is used to update a user's password.

3.File System Basics

Linux's approach to file systems and storage is quite different from Windows. Here’s what you need to know:

  • No Drive Letters: Unlike Windows, which uses drive letters (C:, D:, etc.), Linux incorporates all files and directories into a single directory tree, starting from the root directory /. This structure includes all mounted filesystems, whether they are hard drives, USB drives, or network shares.
  • Mounting Drives: In Linux, new storage devices are mounted to directories. For example, a new hard drive can be mounted to /media/newdrive, contrasting with Windows where a new drive gets a letter. This means in Linux, external storage becomes part of the existing directory tree.
  • Filesystem Types: Linux supports a variety of filesystem types, like ext4, XFS, Btrfs, and others. Regardless of the filesystem type used, Linux does not assign drive letters to these filesystems.
  • File Paths: Linux file paths start from the root directory. For instance, /etc/hosts refers to the hosts file in the /etc directory. This concept is crucial for file navigation and management in Linux.
  • Directory Structure: Important directories include:

    • /home for user personal files (akin to "My Documents" in Windows).
    • /etc for system configuration files.
    • /var for variable data like logs.
    • /bin and /usr/bin for executable programs.

4.Software Management

One of the most significant differences between Linux and Windows is how software is installed and managed. In Linux, this is handled through package managers – tools that automate the process of installing, updating, and removing software.

  • Package Managers: Each major Linux distro comes with its own package manager. For example, Ubuntu uses apt, Fedora has dnf, and CentOS/RHEL uses yum. These package managers handle software dependencies and updates, akin to the Windows Update and Microsoft Store.
  • Software Repositories: Unlike downloading executables from websites as in Windows, Linux distros typically install software from repositories - centralized stores of packaged software. These repositories ensure that you get tested and secure software, optimized for your specific distro.
  • Command-Line Installation: Software installation in Linux is often done through the CLI. For example, installing software in Ubuntu would typically involve a command like sudo apt install [package_name]. This method is powerful and fast, allowing for batch installations and updates.
  • Graphical Interfaces: For those who prefer a graphical interface, most distros offer software centers or package managers with GUIs, like Ubuntu Software Center in Ubuntu or GNOME Software in Fedora. These tools provide a user-friendly interface for searching, installing, and managing software, much like the Microsoft Store in Windows.
  • Updating Software: Regular updates are crucial for security and performance. Linux makes this easy with commands like sudo apt update and sudo apt upgrade in Ubuntu, which refresh the list of available software and install updates, respectively. This is similar to Windows Update, but with more direct control over when and how updates are applied.
  • Removing Software: Uninstalling software in Linux is just as straightforward. A command like sudo apt remove [package_name] will remove the software. Most package managers also clean up any unused dependencies, keeping the system tidy.

5.Service Management

The systemctl command in Linux is a key tool for service management, similar in function to Windows services management but operated through the CLI.

  • Starting and Stopping Services: Use sudo systemctl start [service] and sudo systemctl stop [service] to manage service states.
  • Enabling and Disabling Services: sudo systemctl enable [service] sets a service to start automatically at boot, while sudo systemctl disable [service] prevents it from auto-starting.
  • Checking Service Status: To get detailed information about a service, including its current status and recent activity, use sudo systemctl status [service]. This command is particularly useful for monitoring and troubleshooting services.

6.Networking and Firewall Management

Linux offers a robust and versatile approach to networking and firewall management. Understanding these Linux tools will empower you to manage anything from simple home setups to complex enterprise environments.

  • Setting Up Static and DHCP IP Addresses: Linux allows for detailed IP address configuration through the CLI. For setting a static IP, you can use the nmcli tool (e.g., nmcli con mod [connection_name] ipv4.addresses [IP_address]) or edit network configuration files directly (like /etc/network/interfaces in Debian-based systems). For DHCP, commands like nmcli con mod [connection_name] ipv4.method auto enable automatic IP address assignment. These commands will make permanent changes.
  • Advanced Network Configuration: Linux networking can extend into more advanced realms, such as VLAN tagging within the kernel. With tools like vconfig and ip link, you can create VLANs for network segmentation and management. Moreover, Linux's ability to bond multiple network interfaces - a feature you might know as NIC Teaming in Windows - is achieved through commands like nmcli. This setup is crucial for creating redundant links and enhancing network throughput.
  • Firewall Management: Linux's firewall capabilities are rooted in netfilter, an integral part of the Linux kernel, which provides the underlying framework for powerfull network packet processing. On top of netfilter, tools like the traditional iptables and the modern firewalld are used for firewall management. For example, in iptables, a command like sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT will allow HTTP traffic. In firewalld the command sudo firewall-cmd --permanent --add-port=80/tcp can be used for the same purpose.
  • Remote Access and Management: In place of Windows' Remote Desktop, Linux admins utilize SSH for secure remote operations. Beyond just remote terminal access, you can use SSH for encrypted traffic tunneling, secure file transfers (SCP, SFTP), and even setting up VPN-like connections, bringing a new level of security and versatility to remote server management. For example, establishing secure VPN-like tunnels is done with just one command like ssh -f -N -T -R [port]:localhost:[port] [user]@[remote_host].

7.Optimizations

Optimizing your Linux server is crucial for achieving peak performance and efficiency. Here are some tactics for fine-tuning disk, memory, network and CPU resources:

  • Disk Optimization: To optimize disk performance, use hdparm for HDDs to adjust advanced power management settings and acoustic management. For SSDs, the fstrim command helps in discarding unused blocks. Regular filesystem checks can be performed with sudo fsck /dev/sdX, where X is your drive letter. Cleaning up your system using sudo apt-get autoremove and sudo apt-get clean helps in removing unnecessary files and freeing up disk space.
  • Memory Optimization: Adjusting the swappiness parameter, which controls the preference for swapping out runtime memory, can be done with sudo sysctl vm.swappiness=10 (setting it to 10, for example). Using caching tools like Memcached can greatly improve the performance of database-driven applications by keeping data in memory.
  • Network Optimization: Use ethtool to modify network interface parameters like speed and duplex. TCP tuning can be done with commands like sudo sysctl -w net.ipv4.tcp_mtu_probing=1 to enable MTU probing, which can improve network performance in certain environments. Implementing Quality of Service (QoS) with tc (Traffic Control) allows you to prioritize network traffic and ensure that critical services get the bandwidth they need.
  • CPU Optimization: Utilize nice levels to prioritize processes - for instance, using nice -n 10 [command] to start a process with a lower priority. Cgroups (Control Groups) can also be used to limit the CPU resources available to a group of processes.

8.Logging and Monitoring

Linux provides comprehensive logging and monitoring tools, essential for any server administrator.

  • System Logs: Tools like syslog and journalctl (for systemd) are used for logging system events, akin to the Event Viewer in Windows.
  • Performance Monitoring: Commands like top, htop, and vmstat offer real-time system performance monitoring, similar to Task Manager and Performance Monitor in Windows.

9.Final Thoughts

Linux server administration is a journey of learning and adaptation. While the tools and commands may differ, the underlying principles of server management, security, and performance optimization remain similar. It's worth to keep exploring, practicing, and expanding your skill set as the Linux world offers a rich and diverse landscape for server administration.

Sodrzhinata vo ovoj dokument e licencirana od Interspace so MIT licenca
Linux сервер основи за Windows сервер админи
Содржината е достапна само на англиски јазик.
This guide is for Windows servers admins who want to start using Linux for the first time, with a particular focus on the basics for administering Linux servers through the command-line interface (CLI). It will help you understand Linux fundamentals, drawing parallels to your Windows experience.

1.Choosing a Linux Distro

In the Linux world, distributions or distros are akin to different versions or flavors of the operating system. Each distro is built upon the Linux kernel (the core part of the operating system) but differs in terms of the software and user interface it offers, similar to how various versions of Windows (like Windows Server, Windows 10, Windows 11) have distinct features and interfaces. Here’s a look at some popular distros:

  • Ubuntu: Known for its user-friendliness, Ubuntu is ideal for those new to Linux. It’s comparable to Windows in terms of ease of use and has strong community support.
  • CentOS/RHEL (Red Hat Enterprise Linux): Excellent choices for enterprise environments, offering long-term support and stability. They are akin to Windows Server Datacenter in terms of robustness and advanced features.
  • Debian: Renowned for its stability and reliability, Debian is great for long-term deployments, similar to Windows Long-Term Servicing Channel (LTSC) versions.
  • Fedora: Known for incorporating the latest features, it's excellent for those who want the newest innovations in their Linux experience.
  • openSUSE: Balances between cutting-edge features and stability, suitable for both desktop and server use.
  • Arch Linux: Ideal for experienced users who prefer customizing and building their system from the ground up.

2.User and Group Management

Linux offers a high degree of control and flexibility for managing users and groups. One key aspect of Linux that differs from Windows is the use of sudo for executing commands with elevated privileges.

  • Understanding sudo: In Linux, sudo stands for "superuser do" and is a tool used to run programs with the security privileges of another user, typically the superuser (root). This is comparable to right-clicking and selecting "Run as administrator" in Windows. It is a powerful tool, typically pre-installed on most Linux distros, that ensures administrative commands are executed consciously and securely, reducing the risk of unauthorized system alterations.
  • Creating Users: Use useradd to create a new user. The command sudo useradd -m -s /bin/bash [username] creates a new user with a home directory and bash shell. The sudo here elevates your permissions to execute this administrative task.
  • Managing Groups: The groupadd command creates a new group, and usermod adds users to groups. For instance, sudo usermod -aG [groupname] [username] adds a user to a group
  • Setting Permissions: With chmod and chown, you manage file and directory permissions and ownership. sudo chmod 755 [filename] sets specific read, write, and execute permissions.
  • Password Management: Change user passwords using passwd. The command sudo passwd [username] is used to update a user's password.

3.File System Basics

Linux's approach to file systems and storage is quite different from Windows. Here’s what you need to know:

  • No Drive Letters: Unlike Windows, which uses drive letters (C:, D:, etc.), Linux incorporates all files and directories into a single directory tree, starting from the root directory /. This structure includes all mounted filesystems, whether they are hard drives, USB drives, or network shares.
  • Mounting Drives: In Linux, new storage devices are mounted to directories. For example, a new hard drive can be mounted to /media/newdrive, contrasting with Windows where a new drive gets a letter. This means in Linux, external storage becomes part of the existing directory tree.
  • Filesystem Types: Linux supports a variety of filesystem types, like ext4, XFS, Btrfs, and others. Regardless of the filesystem type used, Linux does not assign drive letters to these filesystems.
  • File Paths: Linux file paths start from the root directory. For instance, /etc/hosts refers to the hosts file in the /etc directory. This concept is crucial for file navigation and management in Linux.
  • Directory Structure: Important directories include:

    • /home for user personal files (akin to "My Documents" in Windows).
    • /etc for system configuration files.
    • /var for variable data like logs.
    • /bin and /usr/bin for executable programs.

4.Software Management

One of the most significant differences between Linux and Windows is how software is installed and managed. In Linux, this is handled through package managers – tools that automate the process of installing, updating, and removing software.

  • Package Managers: Each major Linux distro comes with its own package manager. For example, Ubuntu uses apt, Fedora has dnf, and CentOS/RHEL uses yum. These package managers handle software dependencies and updates, akin to the Windows Update and Microsoft Store.
  • Software Repositories: Unlike downloading executables from websites as in Windows, Linux distros typically install software from repositories - centralized stores of packaged software. These repositories ensure that you get tested and secure software, optimized for your specific distro.
  • Command-Line Installation: Software installation in Linux is often done through the CLI. For example, installing software in Ubuntu would typically involve a command like sudo apt install [package_name]. This method is powerful and fast, allowing for batch installations and updates.
  • Graphical Interfaces: For those who prefer a graphical interface, most distros offer software centers or package managers with GUIs, like Ubuntu Software Center in Ubuntu or GNOME Software in Fedora. These tools provide a user-friendly interface for searching, installing, and managing software, much like the Microsoft Store in Windows.
  • Updating Software: Regular updates are crucial for security and performance. Linux makes this easy with commands like sudo apt update and sudo apt upgrade in Ubuntu, which refresh the list of available software and install updates, respectively. This is similar to Windows Update, but with more direct control over when and how updates are applied.
  • Removing Software: Uninstalling software in Linux is just as straightforward. A command like sudo apt remove [package_name] will remove the software. Most package managers also clean up any unused dependencies, keeping the system tidy.

5.Service Management

The systemctl command in Linux is a key tool for service management, similar in function to Windows services management but operated through the CLI.

  • Starting and Stopping Services: Use sudo systemctl start [service] and sudo systemctl stop [service] to manage service states.
  • Enabling and Disabling Services: sudo systemctl enable [service] sets a service to start automatically at boot, while sudo systemctl disable [service] prevents it from auto-starting.
  • Checking Service Status: To get detailed information about a service, including its current status and recent activity, use sudo systemctl status [service]. This command is particularly useful for monitoring and troubleshooting services.

6.Networking and Firewall Management

Linux offers a robust and versatile approach to networking and firewall management. Understanding these Linux tools will empower you to manage anything from simple home setups to complex enterprise environments.

  • Setting Up Static and DHCP IP Addresses: Linux allows for detailed IP address configuration through the CLI. For setting a static IP, you can use the nmcli tool (e.g., nmcli con mod [connection_name] ipv4.addresses [IP_address]) or edit network configuration files directly (like /etc/network/interfaces in Debian-based systems). For DHCP, commands like nmcli con mod [connection_name] ipv4.method auto enable automatic IP address assignment. These commands will make permanent changes.
  • Advanced Network Configuration: Linux networking can extend into more advanced realms, such as VLAN tagging within the kernel. With tools like vconfig and ip link, you can create VLANs for network segmentation and management. Moreover, Linux's ability to bond multiple network interfaces - a feature you might know as NIC Teaming in Windows - is achieved through commands like nmcli. This setup is crucial for creating redundant links and enhancing network throughput.
  • Firewall Management: Linux's firewall capabilities are rooted in netfilter, an integral part of the Linux kernel, which provides the underlying framework for powerfull network packet processing. On top of netfilter, tools like the traditional iptables and the modern firewalld are used for firewall management. For example, in iptables, a command like sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT will allow HTTP traffic. In firewalld the command sudo firewall-cmd --permanent --add-port=80/tcp can be used for the same purpose.
  • Remote Access and Management: In place of Windows' Remote Desktop, Linux admins utilize SSH for secure remote operations. Beyond just remote terminal access, you can use SSH for encrypted traffic tunneling, secure file transfers (SCP, SFTP), and even setting up VPN-like connections, bringing a new level of security and versatility to remote server management. For example, establishing secure VPN-like tunnels is done with just one command like ssh -f -N -T -R [port]:localhost:[port] [user]@[remote_host].

7.Optimizations

Optimizing your Linux server is crucial for achieving peak performance and efficiency. Here are some tactics for fine-tuning disk, memory, network and CPU resources:

  • Disk Optimization: To optimize disk performance, use hdparm for HDDs to adjust advanced power management settings and acoustic management. For SSDs, the fstrim command helps in discarding unused blocks. Regular filesystem checks can be performed with sudo fsck /dev/sdX, where X is your drive letter. Cleaning up your system using sudo apt-get autoremove and sudo apt-get clean helps in removing unnecessary files and freeing up disk space.
  • Memory Optimization: Adjusting the swappiness parameter, which controls the preference for swapping out runtime memory, can be done with sudo sysctl vm.swappiness=10 (setting it to 10, for example). Using caching tools like Memcached can greatly improve the performance of database-driven applications by keeping data in memory.
  • Network Optimization: Use ethtool to modify network interface parameters like speed and duplex. TCP tuning can be done with commands like sudo sysctl -w net.ipv4.tcp_mtu_probing=1 to enable MTU probing, which can improve network performance in certain environments. Implementing Quality of Service (QoS) with tc (Traffic Control) allows you to prioritize network traffic and ensure that critical services get the bandwidth they need.
  • CPU Optimization: Utilize nice levels to prioritize processes - for instance, using nice -n 10 [command] to start a process with a lower priority. Cgroups (Control Groups) can also be used to limit the CPU resources available to a group of processes.

8.Logging and Monitoring

Linux provides comprehensive logging and monitoring tools, essential for any server administrator.

  • System Logs: Tools like syslog and journalctl (for systemd) are used for logging system events, akin to the Event Viewer in Windows.
  • Performance Monitoring: Commands like top, htop, and vmstat offer real-time system performance monitoring, similar to Task Manager and Performance Monitor in Windows.

9.Final Thoughts

Linux server administration is a journey of learning and adaptation. While the tools and commands may differ, the underlying principles of server management, security, and performance optimization remain similar. It's worth to keep exploring, practicing, and expanding your skill set as the Linux world offers a rich and diverse landscape for server administration.

Содржината во овој документ е лиценцирана од Interspace со МИТ лиценца

Povrzani sodrzhini
Dokumentacija
Klaud
Komunikacii
Hosting
My Interspace
Tehnichki statii
Tutorijali
Nauchi
Novosti
Aktuelni novosti
Posledni nastani
Поврзани содржини
Документација
Клауд
Комуникации
Хостинг
My Interspace
Технички статии
Туторијали
Научи
Новости
Актуелни новости
Последни настани
Povrzani produkti
Elastichen Klaud VPS
Elastichen Klaud VPS pretstavuva virtuelna mashina koja raboti vrz napredni klaud i mrezhni tehnologii, nudejkji znachitelni prednosti vo sporedba so tradicionalniot VPS hosting i nepobedliv odnos na cena so performansi. Postavete OS so aplikacii za samo 1 min. Na eden klik avtomatski bekapi, snapshoti i disaster recovery replika, zachuvani vo drug data centar na bezbedna dalechina. Nova gen na AMD EPYC, ultra brzi NVMe diskovi, dedicirani konekcii i besplatna privatna mrezha.
Premium Internet pristap
Internet od najvisoka klasa za profesionalni potrebi. Superiorna tochka-do-tochka optichka linija, simetrichen download i upload, neogranichen soobrakjaj, SLA dogovor i statichka IP. Direktni konekcii so vrvnite globalni provajderi. Nashata mrezhna arhitektura e so pasija dizajnirana da obezbedi konekcii so najvisok kvalitet do bilo koja destinacija vo svetot, rezultirajkji vo nesporedliva brzina na transfer i povekje stepena redundantnost.
Dedicirani serveri
Dedicirani serveri na visoka klasa na hardver od priznaeni vendori. Hostingot e vo nashi data centri, ovozmozhuvajkji ni celosna kontrola za obezbeduvanje postojan kvalitet i dostapnost 24/7/365. Izbor na primarni data centri i disaster recovery data centar lociran na bezbedna dalechina. Kontrola na napojuvanje (resetiranje, iskluchi/vkluchi) i besplaten KVM-preku-IP, dostapni 24/7 na eden klik, vkluchuvajkji i opcija za startuvanje/instalacija na vashi ISO zapisi.
Поврзани продукти
Еластичен Клауд ВПС
Еластичен Клауд ВПС претставува виртуелна машина која работи врз напредни клауд и мрежни технологии, нудејќи значителни предности во споредба со традиционалниот ВПС хостинг и непобедлив однос на цена со перформанси. Поставете OS со апликации за само 1 мин. На еден клик автоматски бекапи, снапшоти и disaster recovery реплика, зачувани во друг дата центар на безбедна далечина. Нова ген на AMD EPYC, ултра брзи NVMe дискови, дедицирани конекции и бесплатна приватна мрежа.
Премиум Интернет пристап
Интернет од највисока класа за професионални потреби. Супериорна точка-до-точка оптичка линија, симетричен download и upload, неограничен сообраќај, SLA договор и статичка ИП. Директни конекции со врвните глобални провајдери. Нашата мрежна архитектура е со пасија дизајнирана да обезбеди конекции со највисок квалитет до било која дестинација во светот, резултирајќи во неспоредлива брзина на трансфер и повеќе степена редундантност.
Дедицирани сервери
Дедицирани сервери на висока класа на хардвер од признаени вендори. Хостингот е во наши дата центри, овозможувајќи ни целосна контрола за обезбедување постојан квалитет и достапност 24/7/365. Избор на примарни дата центри и disaster recovery дата центар лоциран на безбедна далечина. Kонтрола на напојување (ресетирање, исклучи/вклучи) и бесплатен KVM-преку-IP, достапни 24/7 на еден клик, вклучувајќи и опција за стартување/инсталација на ваши ISO записи.


Нашата веб страна користи колачиња. Ако продолжите со нејзино користење, се согласувате да користиме колачиња и ги прифаќате нашите Правни информации.    Разбирам