Linux Resources
- Home
- Linux Resources
This article covers how to install and configure ClamAV and ClamTK to scan for malware on Ubuntu 20.04.
There aren't many viruses made for Linux distributions and as such, most people who use such systems don't even bother using antivirus software.
Those however who do want to be able to scan their system or other Windows-based systems that are connected to a Linux PC through a network can use ClamAV.
ClamAV is an open-source anti-virus engine that is built to detect viruses, trojans, malware, and other threats.
It supports multiple file formats (documents, executables, or archives), utilizes multi-thread scanner features, and receives updates for its signature database at least 3-4 times a day.
To ClamAV Antivirus on Ubuntu:
The first step is to install and get the latest signature updates. To do this on Ubuntu, you can open a terminal and insert "sudo apt-get install clamav" and press enter.
$ sudo apt install clamav
You may also build ClamAV from sources to benefit from better scanning performance.
To update the signatures, you type "sudo freshclam" on a terminal session and press enter.
$ sudo freshclam
Now we are ready to scan our system.
To do this, you can use the "clamscan" command.
This is a rich command that can work with many different parameters so you'd better insert "clamscan –-help" on the terminal first and see the various things that what you can do with it:
$ clamscan –-help
To Update ClamAV Signature Database:
1. Stop the ClamAV process:
$ systemctl stop clamav-freshclam
2. Manually update the ClamAV signature database:
$ freshclam
3. Restart the service to update the database in the background:
$ systemctl start clamav-freshclam
This article covers the different methods for installing Microsoft PowerShell on Ubuntu which includes installation via package repository, via .deb package, and via snap.
PowerShell for Linux is published to package repositories for easy installation and updates.
As superuser, register the Microsoft repository once.
After registration, you can update PowerShell with sudo apt-get install powershell.
To install PowerShell on Ubuntu 20.04:
PowerShell for Linux is published to package repositories for easy installation and updates.
So do the following;
1. # Update the list of packages.
$ sudo apt-get update
2. # Install pre-requisite packages.
$ sudo apt-get install -y wget apt-transport-https software-properties-common
3. # Download the Microsoft repository GPG keys.
$ wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb
4. # Register the Microsoft repository GPG keys.
$ sudo dpkg -i packages-microsoft-prod.deb
5. # Update the list of products.
$ sudo apt-get update
6. # Enable the "universe" repositories.
$ sudo add-apt-repository universe
7. # Install PowerShell.
$ sudo apt-get install -y powershell
8. # Start PowerShell.
$ pwsh
As superuser, register the Microsoft repository once.
After registration, you can update PowerShell with sudo apt-get install powershell.
To remove PowerShell from Ubuntu:
Run the command,
$ sudo apt-get remove powershell
How to Launch PowerShell on Linux or Mac?
1. Open a terminal and run the "powershell" command to access a PowerShell shell environment.
2. This works on both Linux and Mac–whichever you're using.
3. You'll see a PowerShell prompt beginning with "PS", and you can run PowerShell cmdlets just as you would on Windows.
This article covers how you can easily find out which groups a user belongs to in Ubuntu. Also we shared how to list all groups in a system, list members of a group, add and remove a user from the group. For information about adding/removing users in a system, visit our guide on how to add and remove users on Ubuntu .
Adding a user to an existing group is one of the typical tasks of a Linux administrator.
A group is a collection of users.
The main purpose of the group is to define a set of privileges to their members within the group.
To find out if a user has sudo access is by checking if the said user is member of the sudo group.
If you see the group 'sudo' in the output, the user is a member of the sudo group and it should have sudo access.
In order to list groups on Linux, you have to execute the "cat" command on the "/etc/group" file.
When executing this command, you will be presented with the list of groups available on your system.
To login as Sudo on Ubuntu:
1. Open a terminal Window. Press Ctrl + Alt + T to open the terminal on Ubuntu.
2. To become root user type: sudo -i. sudo -s.
3. When promoted provide your password.
4. After successful login, the $ prompt would change to # to indicate that you logged in as root user on Ubuntu.
What is /etc/passwd file?
"/etc/passwd" is a text file containing every user information that is required to login to the Linux system. It maintains useful information about users such as username, password, user ID, group ID, user information, home directory and shell.
To find out which groups a user belongs to in Linux:
1. groups: Show All Members of a Group.
2. id: Print user and group information for the specified username.
3. lid or libuser-lid: It display user's groups or group's users.
4. getent: Get entries from Name Service Switch libraries.
5. compgen: compgen is bash built-in command and it will show all available commands for the user.
6. members: List members of a group.
7. /etc/group file: Also, we can grep the corresponding user’s groups from the /etc/group file.
What is Wheel Group in Linux?
The wheel group is a special user group used on some Unix systems, mostly BSD systems, to control access to the su or sudo command, which allows a user to masquerade as another user (usually the super user). Debian-like operating systems create a group called sudo with purpose similar to that of a wheel group.
Types of groups in Linux:
1. Primary Group - The primary group is the main group associated with the user account. Each user must be a member of a single primary group.
2. Secondary Group - The secondary or supplementary group is used to grant additional rights to the user. Each user can become a member of multiple secondary groups.
This article covers the installation of the Plex media server on Ubuntu. Using the Plex, you can save all your favorite Tv shows, movies, videos, and photos in a single place. You can approach them from anywhere to any device.
To install Plex Media Server on Ubuntu:
1. Download the .deb package
2. run sudo dpkg -i plexmediaserver_1.19.4.2935-79e214ead_amd64.deb (replacing the last filename with the name of the package you downloaded)
3. To setup Plex Media Server, on the same machine you installed the server on, open a browser window, and go to http://127.0.0.1:32400/web.
To Enable and start Plex media server on Ubuntu:
Execute the following command as sudo: $ sudo systemctl start plexmediaserver.service.
This article covers perform the installation of TeamPass using the LAMP stack on Ubuntu. Now you can easily manage your credentials within your Organization to save credentials and manage access to every individual.
TeamPass is a Collaborative Passwords Manager used for managing passwords and sharing them among team members.
To Download Teampass on Ubuntu:
1. Start by cloning the Teampass repository to your web server root directory as shown below;
$ git clone https://github.com/nilsteampassnet/TeamPass.git /var/www/html/teampass
2. Set the ownership of the teampass web directory to web server user (www-data)
$ chown -R www-data.www-data /var/www/html/teampass/
3. Next, edit the /etc/php/7.2/apache2/php.ini configuration file and increase the script execution time from 30 to 60 secs.
vim /etc/php/7.2/apache2/php.ini
...
;max_execution_time = 30
max_execution_time = 60
...
4. Restart Apache web server
$ systemctl restart apache2
To Finalize TeamPass installation on Ubuntu:
Final installation of Teampass can be done from the browser.
Hence, navigate to the browser and enter the Teampass server URL,
http://Server_IP/teampass.
This will redirect you to Teampass welcome page
This article covers how to install and configure Apache Kafka on your Ubuntu 20.04 LTS machine. Apache Kafka is a distributed events streaming platform which has the ability to handle the high-performance data pipelines. It was originally developed by Linkedin then to be public as an open-source platform and used by many IT companies in the world.
Terms related to Apache Kafka Infrastructure:
1. Topic: A topic is a common name used to store and publish a particular stream of data. For example if you would wish to store all the data about a page being clicked, you can give the Topic a name such as "Added Customer".
2. Partition: Every topic is split up into partitions ("baskets"). When a topic is created, the number of partitions need to be specified but can be increased later as need arises. Each message gets stored into partitions with an incremental id known as its Offset value.
3. Kafka Broker: Every server with Kafka installed in it is known as a broker. It is a container holding several topics having their partitions.
4. Zookeeper: Zookeeper manages Kafka's cluster state and configurations.
Main advantages of using Apache Kafka:
1. Message Broking: In comparison to most messaging systems Kafka has better throughput, built-in partitioning, replication, and fault-tolerance which makes it a good solution for large scale message processing applications
2. Website Activity Tracking
3. Log Aggregation: Kafka abstracts away the details of files and gives a cleaner abstraction of log or event data as a stream of messages.
4. Stream Processing: capturing data in real-time from event sources; storing these event streams durably for later retrieval; and routing the event streams to different destination technologies as needed
5. Event Sourcing: This is a style of application design where state changes are logged as a time-ordered sequence of records.
6. Commit Log: Kafka can serve as a kind of external commit-log for a distributed system. The log helps replicate data between nodes and acts as a re-syncing mechanism for failed nodes to restore their data.
7. Metrics: This involves aggregating statistics from distributed applications to produce centralized feeds of operational data.
To install Apache Kafka on Ubuntu:
1. Update your fresh Ubuntu 20.04 server and get Java installed as illustrated below.
$ sudo apt update && sudo apt upgrade
$ sudo apt install default-jre wget git unzip -y
$ sudo apt install default-jdk -y
2. Fetch Kafka on Ubuntu 20.04.
$ cd ~
$ wget https://downloads.apache.org/kafka/2.6.0/kafka_2.13-2.6.0.tgz
$ sudo mkdir /usr/local/kafka-server && cd /usr/local/kafka-server
$ sudo tar -xvzf ~/kafka_2.13-2.6.0.tgz --strip 1
3. Create Kafka and Zookeeper Systemd Unit Files
i. Let us begin with Zookeeper service.
$ sudo vim /etc/systemd/system/zookeeper.service
[Unit]
Description=Apache Zookeeper Server
Requires=network.target remote-fs.target
After=network.target remote-fs.target
[Service]
Type=simple
ExecStart=/usr/local/kafka-server/bin/zookeeper-server-start.sh /usr/local/kafka-server/config/zookeeper.properties
ExecStop=/usr/local/kafka-server/bin/zookeeper-server-stop.sh
Restart=on-abnormal
[Install]
WantedBy=multi-user.target
ii. Then for Kafka service. Make sure your JAVA_HOME configs are well inputted or Kafka will not start.
$ sudo vim /etc/systemd/system/kafka.service
[Unit]
Description=Apache Kafka Server
Documentation=http://kafka.apache.org/documentation.html
Requires=zookeeper.service
After=zookeeper.service
[Service]
Type=simple
Environment="JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64"
ExecStart=/usr/local/kafka-server/bin/kafka-server-start.sh /usr/local/kafka-server/config/server.properties
ExecStop=/usr/local/kafka-server/bin/kafka-server-stop.sh
Restart=on-abnormal
[Install]
WantedBy=multi-user.target
iii. Reload the systemd daemon to apply changes and then start the services.
$ sudo systemctl daemon-reload
$ sudo systemctl enable --now zookeeper
$ sudo systemctl enable --now kafka
$ sudo systemctl status kafka zookeeper
4. Install Cluster Manager for Apache Kafka (CMAK) | Kafka Manager.
$ cd ~
$ git clone https://github.com/yahoo/CMAK.git
5. Configure CMAK on Ubuntu.