1 | sudo curl -SL https://github.com/docker/compose/releases/download/v2.18.1/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose |
To show CPU info on Linux
1 | lscpu |
1 | Architecture: x86_64 |
Note:
1 | # The other one |
How to set dynamic IP address on Ubuntu 16.04?
To set dynamic IP address on Ubuntu 16.04, you can follow these steps:
- Open the terminal by pressing Ctrl+Alt+T.
- Type the command “sudo vi /etc/network/interfaces” and press Enter. This will open the “interfaces” file in the vi text editor with root privileges.
- Find the line for the network interface you want to configure (e.g., “iface eth0 inet dhcp”) and ensure that it is configured for “dhcp” for dynamic IP address. If not, change “static” to “dhcp”.
- Save and close the file by pressing Ctrl+O, Enter, and then Ctrl+X.
- Restart the networking service to apply the changes by typing the command “sudo service networking restart” and pressing Enter.
1 | # This file describes the network interfaces available on your system |
Your network interface should now be configured to obtain an IP address dynamically. You can confirm the change by using the “ip addr show” command and checking for an IP address assigned by DHCP server.ver.
How to disable SELinux on Ubuntu?
To disable SELinux on Ubuntu, follow these steps:
Open the terminal by pressing
Ctrl+Alt+T
on your keyboard.Type the following command to install the SELinux management tool:
1
sudo apt-get install selinux-utils
Once the installation is complete, run the following command to disable SELinux:
1
sudo selinux-disable
Restart your Ubuntu system to apply the changes made.
Note: Disabling SELinux may weaken your system’s security. Only disable SELinux if you know what you are doing or if it is causing issues. It’s recommended to consult with an expert if you are unsure.
How to install and use Git on Ubuntu?
1. Install Git
First, you need to install Git on your Ubuntu system. Open the terminal and run the following command:
1 | sudo apt-get update |
2. Verify Git installation
Next, you can verify that Git has been installed correctly by running the following command:
1 | git --version |
This should print the version of Git you just installed. For example, git version 2.25.1
.
3. Set your Git username and email
Before you can start using Git, you need to set your username and email address. You can do this with the following commands, replacing “Your Name” and “youremail@example.com“ with your own information:
1 | git config --global user.name "My Name" |
4. Create a new Git repository
To create a new Git repository, navigate to the directory where you want to create it and run the following command:
1 | git init |
This will initialize a new Git repository in the current directory.
5. Add and commit changes
Now that you have a Git repository, you can start adding and committing changes to it. For example, let’s say you make a change to a file called “index.html”. You can add this change to your Git repository with the following command:
1 | git add index.html |
This will stage the changes you made to the file. Once you’ve added all the changes you want to commit, you can run the following command to commit them:
1 | git commit -m "Add changes to index.html" |
This will commit your changes with a message describing what you changed.
6. Push changes to a remote repository
If you want to collaborate with others, you can push your changes to a remote Git repository. For example, let’s say you’ve created a repository on GitHub called “myproject”. You can push your changes to this repository with the following command:
1 | git remote add origin https://github.com/username/myproject.git |
This will push your changes to the “master” branch of the “myproject” repository on GitHub.
That’s it! These are the basic steps to install and use Git on Ubuntu. Of course, there are many more advanced features and commands you can use, but this should be enough to get you started.ted.
How to use user groups and permissions to manage files and directories?
Step 1: Create a new user group
If you don’t already have a group that you want to use for managing your files and directories, you’ll need to create one. You can use the groupadd
command to create a new group. For example, to create a group called developers
, you can run the following command:
1 | sudo groupadd developers |
Step 2: Add users to the group
Once you have created the group, you can add users to it using the usermod
command. For example, to add the user johndoe
to the developers
group, you can run the following command:
1 | sudo usermod -a -G developers johndoe |
Step 3: Set the group ownership of files and directories
To give the developers
group ownership of a file or directory, you can use the chgrp
command. For example, to give the developers
group ownership of a directory called project
, you can run the following command:
1 | sudo chgrp developers /path/to/project |
Step 4: Set the permissions on files and directories
Finally, to set the permissions on a file or directory, you can use the chmod
command. The permissions are typically represented as a series of 3 digits, where each digit corresponds to the permissions for the owner, group, and others. The permissions include read (4
), write (2
), and execute (1
). For example:
1 | - 7 = read, write, and execute (4 + 2 + 1) |
To set the permissions on a directory, you’ll typically want to use the chmod
command with the -R
option to apply the permissions recursively (i.e., to all files and subdirectories within the directory). For example, to give the developers
group read and write permissions on the project
directory and all its contents, you can run the following command:
1 | sudo chmod -R 770 /path/to/project |
In the above example, 7
represents read, write, and execute permissions for the owner; 7
represents the same permissions for the developers
group; and 0
means no permissions for others.
That’s it! With these four steps, you can use user groups and permissions to effectively manage your files and directories.
How to install Node.js on Ubuntu?
Open the Terminal by either searching for it in the launcher or by using the shortcut
Ctrl + Alt + T
.Update your system by running the command:
1
sudo apt update
Install the prerequisite packages that are needed to run Node.js:
1
sudo apt install curl wget
Download and install the Node.js package by running the following commands. Replace the
XX
with the version number you wish to install.1
2curl -sL https://deb.nodesource.com/setup_XX.x | sudo -E bash -
sudo apt install -y nodejs
For example, if you want to install version 14, you would enter:
1 | curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash - |
- Verify the installation using the following command:This should display the version number of Node.js that you have installed on your system.
1
node -v
That’s it! You have successfully installed Node.js on your Ubuntu system.
How to install Samba server on Ubuntu?
First, open up the terminal on your Ubuntu machine.
Update your system’s package list using the following command:
1 | sudo apt update |
- Once the package list is updated, you can install Samba server by running the following command:
1 | sudo apt install samba |
During the installation process, the system will prompt you to configure your Samba server. You can select “No” to the first option (“WINS support”) and “Yes” to the second option (“Create a new Samba configuration file”).
Once the installation is complete, you can open up the configuration file using your preferred text editor. Here’s an example using the built-in Nano editor:
1 | sudo nano /etc/samba/smb.conf |
- In the configuration file, you can define shared directories and set up authentication. Here’s an example of how you can define a sample shared directory:
1 | [Shared Folder] |
In this example, “Shared Folder” is the name of the share that you want to create, “/srv/samba/share” is the path to the directory you want to share, “read only” is set to “no” so users can write to the share, and “guest ok” is set to “yes” to allow unauthenticated access.
- Once you have defined your shares in the configuration file, you can restart the Samba server using the following command:
1 | sudo systemctl restart smbd |
That’s it! You should now have a working Samba server on your Ubuntu machine.
How to install an FTP server on Ubuntu?
Open up a terminal window on your Ubuntu machine. You can do this by clicking the “Activities” button located at the top left corner of the screen and typing “terminal” into the search bar that appears.
Update the package index and upgrade the system using the following commands:
1 | sudo apt-get update |
- Install the FTP server software. We will use the popular
vsftpd
package. You can do this by running the command:
1 | sudo apt-get install vsftpd |
- Once the installation is completed, open the
vsftpd.conf
file using your favourite text editor. Here we will usenano
:
1 | sudo nano /etc/vsftpd.conf |
- Make changes to the configuration file to suit your needs. Here, we will only make two changes.
First, uncomment the line write_enable=YES
to enable uploading files.
Second, you may set the anonymous_enable setting to NO allowing only authenticated user to use the FTP server.
1 | write_enable=YES |
Save and close the configuration file.
Restart the FTP server for the changes to take effect by running the following command:
1 | sudo service vsftpd restart |
- Finally, test the FTP server by connecting to it using an FTP client such as FileZilla, WinSCP or Cyberduck.
That’s it! You now have an FTP server installed on Ubuntu and ready to use.
How to install Nginx server on Ubuntu?
First, open the terminal by pressing
Ctrl+Alt+T
on your keyboard.Update the package list using the following command:
1
sudo apt-get update
Install Nginx using the following command:
1
sudo apt-get install nginx
Once the installation is complete, start the Nginx service using the following command:
1
sudo systemctl start nginx
Verify that Nginx is running by entering the server’s IP address or
http://localhost
in your web browser. You should see the Nginx default landing page.If you want to make sure that Nginx starts automatically at boot time, run the following command:
1
sudo systemctl enable nginx
Congratulations! You’ve successfully installed Nginx on Ubuntu.
Here’s an example of what the default landing page looks like when you navigate to the IP address of your server in a web browser: