debian – TecAdmin https://tecadmin.net How to guide for System Administrator's and Developers Thu, 05 Jan 2023 17:21:54 +0000 en-US hourly 1 https://wordpress.org/?v=6.1.1 How to Install and Use Flask on Debian 11/10 https://tecadmin.net/how-to-install-flask-on-debian/ https://tecadmin.net/how-to-install-flask-on-debian/#respond Thu, 05 Jan 2023 16:56:31 +0000 https://tecadmin.net/?p=33627 Flask is a microweb framework written in Python that is widely used for building web applications. It is a lightweight framework that does not require particular tools or libraries to be installed. Flask provides developers with the ability to add functionality to their applications through the use of libraries and modules. In this tutorial, we [...]

The post How to Install and Use Flask on Debian 11/10 appeared first on TecAdmin.

]]>
Flask is a microweb framework written in Python that is widely used for building web applications. It is a lightweight framework that does not require particular tools or libraries to be installed. Flask provides developers with the ability to add functionality to their applications through the use of libraries and modules.

In this tutorial, we will show you how to install Flask on Debian 11. Debian 11, also known as “Bullseye,” is the latest stable release of the Debian operating system. It is a free and open-source operating system that is widely used on servers and other systems.

Prerequisites

Before you start, make sure that you have Python and pip installed on your system. You can check if you have Python installed by running the following command:

python3 --version 

If you do not have Python installed, you can install it by running the following command:

sudo apt update 
sudo apt install python3 python3-pip python3-venv 

To check if you have pip installed, run the following command:

python3 --version 
pip3 --version 

Step 1: Installing Flask

Once you have Python and pip installed, you can install Flask system-wide by running the following command: `pip3 install flask`

But I recommended creating a virtual environment for your Flask application.

  1. Create a directory for your Flask application:
    mkdir flask-app && cd flask-app 
    
  2. Create the Python virtual environment.
    python3 -m venv venv 
    
  3. Activate the virtual environment:
    source venv/bin/activate 
    
  4. Install the Python Flask module within the virtual environment.
    pip3 install flask 
    

This will install the latest version of Flask and all the required dependencies under the virtual environment.

Step 2: Creating a Flask Application

Now that Flask is installed, you can create your first Flask application. Switch to the newly created application directory:

cd flask-app 

Next, create a file called `app.py` and add the following code to it:

from flask import Flask

app = Flask(__name__)

@app.route('/')
def hello():
    return 'Hello, World!'

if __name__ == '__main__':
    app.run()

This code creates a simple Flask app that listens for incoming HTTP requests on the root path (/) and returns the message “Hello, World!”.

Step 3: Run Your Flask Application

To run the application, execute the following command:

flask run 

This will start the Flask development server and you will see the following output:

Output:
* Serving Flask app "app" * Environment: production WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. * Debug mode: off * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)

Now, open your web browser and go to “http://127.0.0.1:5000/” to view your Flask app. You should see the message “Hello, World!” displayed on the page.

Conclusion

In this tutorial, you learned how to install and use Flask on Debian 11. You also learned how to create a simple Flask app and run it using the Flask development server. Flask is a powerful and easy-to-use web framework that makes it easy to build web applications with Python.

The post How to Install and Use Flask on Debian 11/10 appeared first on TecAdmin.

]]>
https://tecadmin.net/how-to-install-flask-on-debian/feed/ 0
Setup Selenium with Python and Chrome Driver on Ubuntu & Debian https://tecadmin.net/setup-selenium-with-python-on-ubuntu-debian/ https://tecadmin.net/setup-selenium-with-python-on-ubuntu-debian/#comments Sun, 19 Jun 2022 04:12:49 +0000 https://tecadmin.net/?p=30109 Selenium is a versatile tool that can be used for automating browser-based tests. It has a wide range of features that make it an ideal choice for automating tests. Selenium can be used to automate tests for web applications and web services. Selenium supports a number of programming languages, including Java, C#, Python, and Ruby. [...]

The post Setup Selenium with Python and Chrome Driver on Ubuntu & Debian appeared first on TecAdmin.

]]>
Selenium is a versatile tool that can be used for automating browser-based tests. It has a wide range of features that make it an ideal choice for automating tests. Selenium can be used to automate tests for web applications and web services. Selenium supports a number of programming languages, including Java, C#, Python, and Ruby.

This makes it possible to write tests in the language that you are most comfortable with. In addition, Selenium has a large user community that provides support and help when needed.

In this blog post, you will learn to set up a Selenium environment on an Ubuntu system. Also provides you with a few examples of Selenium scripts written in Python.

Prerequisites

You must have Sudo privileged account access to the Ubuntu system.

One of the examples also required a desktop environment to be installed.

Step 1: Installing Google Chrome

Use the below steps to install the latest Google Chrome browser on Ubuntu and Debian systems.

  1. First of all, download the latest Gooogle Chrome Debian package on your system.
    wget -nc https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb 
    
  2. Now, execute the following commands to install Google Chrome from the locally downloaded file.
    sudo apt update 
    sudo apt install -f ./google-chrome-stable_current_amd64.deb 
    

    Press ‘y’ for all the confirmations asked by the installer.

This will complete the Google Chrome on your Ubuntu or Debian system. This will also create an Apt PPA file for further upgrades.

Step 2: Installing Selenium and Webdriver for Python

We will use a virtual environment for running Python scripts. Follow the below steps to create Python virtual environment and install the required python modules.

  1. Create a directory to store Python scripts. Then switch to the newly-created directory.
    mkdir tests && cd tests 
    
  2. Set up the Python virtual environment and activate it.
    python3 -m venv venv 
    source venv/bin/activate 
    

    Once the environment is activated, You will find the updated prompt as shown below screenshot:

    Create Python Environment for Selenium on Ubuntu
    Create Python Environment for Selenium on Ubuntu
  3. Now use PIP to install the selenium and webdriver-manager Python modules under the virtual environment.
    pip install selenium webdriver-manager 
    

    Installing Selenium and Webdriver Python Module on Ubuntu & Debian
    Installing Selenium and Webdriver Python Module on Ubuntu & Debian

Example 1: Selenium Python Script with Headless Chrome

Your system is ready to run Selenium scripts written in Python. Now, create a sample selenium script in Python that fetches the title of a website.

This script will run headless, So you can run it without an X desktop environment. You can simply SSH to your system and run the below example:

  1. Create a Python script and edit it in your favorite text editor:
    nano test.py 
    
  2. Copy-paste the following Selenium Python script to the file.
    from selenium import webdriver
    from selenium.webdriver.chrome.options import Options
    from selenium.webdriver.chrome.service import Service
    from webdriver_manager.chrome import ChromeDriverManager
    
    options = Options()
    options.add_argument('--headless')
    options.add_argument('--no-sandbox')
    options.add_argument('--disable-dev-shm-usage')
    driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)
    
    driver.get("https://python.org")
    print(driver.title)
    driver.close()

    Press CTRL + O to save content to the file and press CTRL + X to close the editor.

  3. Now, run this Python script in a shell.
    python test.py 
    

    You will see the output something like the below:

    Running Selenium Python Script in Ubuntu & Debian
    Running the Selenium Python Script

Example 2: Selenium Python Script with Chrome GUI

In order to run this example, the Ubuntu system must have installed a Desktop environment. If the desktop is not installed, use another tutorial to install the Desktop environment on Ubuntu systems.

Now, log in to the desktop interface and try to run the below example.

  1. Open a command prompt, then create a new Python script and edit it in your favorite text editor.
    nano test.py 
    
  2. Copy-paste the below snippet in the file:

    import time
    from selenium import webdriver
    from selenium.webdriver.chrome.options import Options
    from selenium.webdriver.chrome.service import Service
    from selenium.webdriver.common.by import By
    from selenium.webdriver.common.keys import Keys
    from webdriver_manager.chrome import ChromeDriverManager
    
    options = Options()
    # options.add_argument('--headless')
    # options.add_argument('--no-sandbox')
    options.add_argument('--disable-dev-shm-usage')
    driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)
    
    driver.get('http://www.google.com')
    search = driver.find_element(by=By.NAME, value="q")
    search.send_keys("Hey, Tecadmin")
    search.send_keys(Keys.RETURN)
    
    time.sleep(5)
    driver.close()

    Write the changes to file with CTRL + O and close this with keyboard shortcut CTRL + X

  3. This is a Selenium script written in Python, that will launch the Google Chrome web browser and search for a defined string. then close the browser.
  4. Run the Python script in the terminal:
    python test2.py 
    

    You will see that a Browser window will open and perform the defined tasks in the script. See the below screencast of the run:

Conclusion

In this tutorial, you have learned about the configuration of Selenium for Python on Ubuntu and Debian Linux systems. Also provides you with two Selenium examples. Hope this tutorial helps you to understand to run Selenium with Python.

The post Setup Selenium with Python and Chrome Driver on Ubuntu & Debian appeared first on TecAdmin.

]]>
https://tecadmin.net/setup-selenium-with-python-on-ubuntu-debian/feed/ 1 debian Archives – TecAdmin nonadult
How to Setup Squid Proxy Server on Ubuntu and Debian https://tecadmin.net/how-to-setup-squid-proxy-server-on-ubuntu-and-debian/ https://tecadmin.net/how-to-setup-squid-proxy-server-on-ubuntu-and-debian/#respond Fri, 17 Jun 2022 11:29:48 +0000 https://tecadmin.net/?p=30131 What is Squid? Squid is a proxy server that can be used to improve network performance and security. It can be used to cache web pages and images, allowing your users to access these files more quickly. Squid can also be used to protect your network from malicious content. If you’re an experienced system administrator, [...]

The post How to Setup Squid Proxy Server on Ubuntu and Debian appeared first on TecAdmin.

]]>
What is Squid?

Squid is a proxy server that can be used to improve network performance and security. It can be used to cache web pages and images, allowing your users to access these files more quickly. Squid can also be used to protect your network from malicious content.

If you’re an experienced system administrator, you know that a proxy server can be a valuable tool for optimizing your network.

In this blog post, we’ll show you how to install a proxy server on Ubuntu using the Squid proxy server.

How to install Squid on Ubuntu and Debian

To install Squid on Ubuntu and Debian, use the following commands:

sudo apt update  
sudo apt install squid3  
How to Install Squid Proxy on Ubuntu and Debian
Installing squid proxy server

The Squid proxy server will be installed on your Ubuntu system.

You can verify the service status by running the following command:

sudo systemctl status squid3  
Output
● squid.service - Squid Web Proxy Server Loaded: loaded (/lib/systemd/system/squid.service; enabled; vendor preset: enabled) Active: active (running) since Fri 2022-06-17 11:13:54 IST; 45s ago Docs: man:squid(8) Process: 2267 ExecStartPre=/usr/sbin/squid --foreground -z (code=exited, status=0/SUCCESS) Main PID: 2270 (squid) Tasks: 4 (limit: 2271) Memory: 15.7M CPU: 187ms CGroup: /system.slice/squid.service ├─2270 /usr/sbin/squid --foreground -sYC ├─2272 "(squid-1)" --kid squid-1 --foreground -sYC ├─2273 "(logfile-daemon)" /var/log/squid/access.log └─2274 "(pinger)" Jun 17 11:13:54 tecadmin squid[2272]: Using Least Load store dir selection Jun 17 11:13:54 tecadmin squid[2272]: Set Current Directory to /var/spool/squid Jun 17 11:13:54 tecadmin squid[2272]: Finished loading MIME types and icons. Jun 17 11:13:54 tecadmin squid[2272]: HTCP Disabled. Jun 17 11:13:54 tecadmin squid[2272]: Pinger socket opened on FD 14 Jun 17 11:13:54 tecadmin squid[2272]: Squid plugin modules loaded: 0 Jun 17 11:13:54 tecadmin squid[2272]: Adaptation support is off. Jun 17 11:13:54 tecadmin squid[2272]: Accepting HTTP Socket connections at conn3 local=[::]:3128 remote=[::] FD 12 flags=9

After you have installed Squid, you will need to configure it to meet your needs. The default configuration should be suitable for most users, but you may need to make some changes depending on your specific needs.

How to Configure Squid Proxy Server

The main Squid configuration file is located at /etc/squid3/squid.conf. This file contains all of the settings for Squid. You can edit this file to change the configuration of Squid.

  1. Configure Port
  2. To configure the Squid port, you’ll need to edit the squid.conf file. This file is located in the /etc/squid directory on most Linux systems. Once you’ve opened the file in a text editor, you’ll need to locate the following line:

    http_port 3128
    

    If you need to change the Squid port, you can simply edit this line and enter the new port number. For example, if you want to use port 8080, you would enter:

    http_port 8080
    
    Changing Squid Server Port in Ubuntu & Debian
    Set a new port to Squid server

    Once you’ve made the change, save the file and restart Squid.

    Note: You can also configure Squid as transparrent proxy server by adding transparent keyword with the port like http_port 8080 transparent .

  3. Configuring Firewall Rules
  4. In order to use Squid, you will need to enable it in the Ubuntu firewall. You can do this by running the following command:

    • UFW Users:
      sudo ufw allow 8080 
      
    • FirewallD Users:
      sudo firewall-cmd --permanent --zone=public --add-port=3128/tcp 
      sudo firewall-cmd –reload 
      

    This command will allow traffic on port 8080, which is the port that Squid listens on.

  5. Configure Proxy Authentication in Squid
  6. You can also insist users to authenticate proxy to use. This helps you to prevent unauthorized access to the proxy server. This forces users to authenticate to use the proxy.

    • First, install apache2-utils package, that provides htpasswd command.
      sudo apt-get install apache2-utils -y  
      
    • Create a new file to contain username and password. Also change ownership to the Squid user proxy:
      sudo touch /etc/squid/secure_passwd 
      sudo chown proxy: /etc/squid/secure_passwd 
      
    • Create a new user with following commnad:
      sudo htpasswd /etc/squid/secure_passwd tecadmin 
      

      The system will prompt you to enter and confirm a password for “tecadmin” user.

    • Edit the /etc/squid/squid.conf file, and add the following configuration:
      auth_param basic program /usr/lib64/squid/basic_ncsa_auth /etc/squid/secure_passwd
      auth_param basic children 5
      auth_param basic realm Squid Basic Authentication
      auth_param basic credentialsttl 2 hours
      acl auth_users proxy_auth REQUIRED
      http_access allow auth_users
      
    • Restart Squid service.

  7. Create ACL to Block Websites
  8. You can block any website by its domain name. To do the following:

    • Create a new file /etc/squid/blocked_websites.acl and edit in a text editor. You can choose any name of your choice.
      sudo nano /etc/squid/blocked_websites.acl 
      
    • In this file, add the domain names one per line to be blocked. You can start the domain name with a dot (.) to blcok subdomains as well.
      .yahoo.com
      .facebook.com
      
    • Edit the /etc/squid/squid.conf file again.
      sudo nano /etc/squid/squid.conf 
      
    • Add the following lines just before the ACL list.
      acl blocked_websites dstdomain “/etc/squid/blocked.acl”
      http_access deny blocked_websites
      

      Save changes and restart Squid service.

Conclusion

In this article, we will go over the steps on how to install a Squid proxy server on an Ubuntu server. We will also cover some basic configurations that can be made to Squid once it is installed. By the end of this article, you should have a working installation of the Squid proxy server on your Ubuntu server.

The post How to Setup Squid Proxy Server on Ubuntu and Debian appeared first on TecAdmin.

]]>
https://tecadmin.net/how-to-setup-squid-proxy-server-on-ubuntu-and-debian/feed/ 0
How To Install Oracle VirtualBox on Debian 11 https://tecadmin.net/how-to-install-oracle-virtualbox-on-debian-11/ https://tecadmin.net/how-to-install-oracle-virtualbox-on-debian-11/#respond Sat, 19 Feb 2022 10:08:58 +0000 https://tecadmin.net/?p=28625 The VirtualBox is a powerful tool for virtualization developed by Oracle Corporation. It is a widely used commercial by large enterprises as well as home users. VirtualBox 6.1 is the latest major release by the Oracle team. This version is released with various performance improvements over the previous major releases. This tutorial will help you [...]

The post How To Install Oracle VirtualBox on Debian 11 appeared first on TecAdmin.

]]>
The VirtualBox is a powerful tool for virtualization developed by Oracle Corporation. It is a widely used commercial by large enterprises as well as home users. VirtualBox 6.1 is the latest major release by the Oracle team. This version is released with various performance improvements over the previous major releases.

This tutorial will help you to install VirtualBox on Debian 11 Bullseye Linux system.

Before we start

Login to the Debian 11 desktop system with a sudo privileges account. Update all the currently installed packages on your system. To do this simply run the following commands.

sudo apt update && sudo apt upgrade 

Step 1 – Setup Apt Repository

First of all, You need to add Oracle public keys to your system, which is used to sign the Debian packages. You can add these keys with the following commands.

wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add - 
wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add - 

Then configure the apt repository on your Debian 10 Buster system. This command will add an entry to /etc/apt/sources.list file at end of the file.

sudo add-apt-repository "deb http://download.virtualbox.org/virtualbox/debian buster contrib" 

Step 3 – Install VirtualBox on Debian 10

After completing the above steps, let’s install VirtualBox using the following commands. If you have already installed an older version of VirtualBox, the Below command will update it automatically.

sudo apt update 
sudo apt install virtualbox-6.1 

That’s it. You have successfully installed Virtualbox on your Linux system.

Step 4 – Launch VirtualBox

You can use the dashboard navigation tool to start VirtualBox or simply execute the following command from a terminal.

virtualBox & 

virtualbox-on-ubuntu

The post How To Install Oracle VirtualBox on Debian 11 appeared first on TecAdmin.

]]>
https://tecadmin.net/how-to-install-oracle-virtualbox-on-debian-11/feed/ 0
Top 5 Most Stable Linux Distributions in 2022 https://tecadmin.net/best-stable-linux-distributions/ https://tecadmin.net/best-stable-linux-distributions/#comments Tue, 12 Oct 2021 04:18:57 +0000 https://tecadmin.net/?p=28125 Stable Linux Distributions in 2022 – Linux is one of the utmost famous and free open-source platforms. Linux has recently gained a lot of attention and is widely used due to its security, scalability, and flexibility. The distribution named Linux does all the hard work for you by taking codes from open-source till compiling and [...]

The post Top 5 Most Stable Linux Distributions in 2022 appeared first on TecAdmin.

]]>
Stable Linux Distributions in 2022 – Linux is one of the utmost famous and free open-source platforms. Linux has recently gained a lot of attention and is widely used due to its security, scalability, and flexibility. The distribution named Linux does all the hard work for you by taking codes from open-source till compiling and then combining them into a single operating system so that you’re easily able to boot up and install. Furthermore, they also provide you with different options such as the default desktop environment, browser, and other software. Users can get an operating system by installing one of the most stable Linux distros.

Linux has numerous distinct features for different users. There are lots of Linux distributions for a variety of uses, including education, gaming, and developing software. Somehow I can find so many different Linux distributions that I can’t even remember the exact numbers. There are some unique tendencies, revealed in some clones of each other. So it’s kind of confusing. But that’s the beauty of Linux. Few features of Linux distributions are quite identical to one another, but some distributions have their own user interface and unique features.

Although there are numerous Linux distributions, this article conveys the topmost stable Linux distributions of 2022 currently available.

List of Most Stable Linux Distributions

It is quite common for the term “stable” to be used with Linux operating systems or with a distro, this is because of the accessibility of the modification like updating repositories according to user requirements. Out of these modifications, some of them are vital like Debian, roughly like a fork of a base distribution; Arch, Ubuntu, and many others like Mint.

However, they are unable to fulfill numerous features like support and documentation. In this article, we will list down the top 5 most stable Linux Distros carrying good support, repositories, updating regularly, quite easy to use, and durable.

1. Debian Linux

On top of the list, Debian Linux is the most stable Linux distribution. The great thing about it is that it is user-friendly, lightweight, and compatible with other environments. The Debian team has a longer work period, which allows them to fix most of the bugs before releasing a new version.

The current stable distribution of Debian is version 11, codenamed bullseye. Can be downloaded free from the official download page.

Debian Linux
Debian Linux

Main Features

  • Effectively repair bugs
  • It does not require maintenance and the software can be updated itself.
  • The official archive upholds cutting-edge and modern packages of programming.
  • Package manager i.e. Apt the ability to control dependency issues and proficiently orphaned packages

2. Linux Mint

There is always tough competition to be at the top place and the Linux Mint is not far behind. It is the most widely used distribution and is dependent on Debian and Ubuntu. Linux Mint is one of the most well-known Linux distributions that are both free, community-centric open-source Linux distributions with a huge number of packages.

Linux mint was titled as the best distribution in October 2012. “Vanessa” is the latest version, released in July 2022 whereas the older version of this environment was “Ulyssa”. Linux mint also maintains and supports operating systems in Python and helps to modify its software.

Linux Mint
Linux Mint

Main Features:

  • Easy to use
  • Completely supports interactive multimedia
  • Comes with basic software such as “LibreOffice, Thunderbird, HexChat, Pidgin”
  • Linux Mint offers you to download numerous software like “transmission and VLC media player” by using the package manager.
  • Easy to install for newbies
  • Linux Mint also accompanies numerous flavors like “Cinnamon, GNOME, KDE”, etc.

3. Ubuntu

Ubuntu is considered the most established Linux distribution for Debian beginners. It is pre-installed on many laptops these days. The good thing is, Ubuntu has its own repositories and functionalities which are frequently synced with the repositories of Debian.

Ubuntu is a well-known, open-source desktop that contains various applications like an office suite, email and media applications, and so forth. For example, you can easily make presentations, assignments, and formal documents on Ubuntu with LibreOffice.

Ubuntu Linux
Ubuntu Linux

Main Features:

  • The graphical user interface is easy to use as you can easily customize the look according to your needs.
  • Ubuntu has a secure platform.
  • It supports numerous desktop environments i.e. “Unity, XFCE, MATE”, etc.
  • Most customizable distribution for super users.

4. Slackware

Slackware Linux is one of the oldest continuously-developed distributions, having been created by Patrick Volkerding in 1993. that is designed for advanced users who are looking for a secure, stable, and reliable distribution. It has a proven record of reliability and stability, making it a popular choice among advanced users. It is also known for its customizability and comes with a large number of preinstalled packages. It can be used on a wide range of hardware, from low-end PCs to supercomputers.

Slackware Linux
Slackware Linux

Main Features:

  • The oldest Linux operating system with continuous development
  • Flexible and stable distribution
  • Can be easily installed on older hardware.

5. OpenSUSE

OpenSUSE is another incredibly stable Linux distro developed by various companies and SUSE Linux. The purpose of OpenSUSE is to make easily accessible open-source tools by giving developers a user-friendly environment.
OpenSUSE combines and collaborates in order to stop conveying the ordinary release and focus to deliver the most stable distros. The code of OpenSUSE usually takes each one of the extraordinary characteristics from the Enterprise of SUSE Linux and gives the other way around.

Opensuse Linux
Opensuse Linux

Main Features:

  • User friendly
  • It also supports graphic cards.
  • It has various characteristics of “GNOME, KDE, Cinnamon, LXDE, Xfce, Openbox”, etc.

Conclusion

As you can see, each Linux distribution has its own unique features and is optimized to perform specific tasks. This article conveys the top 5 most stable Linux Distributions for 2022.

The term stable is very relative when it comes to operating systems. It depends on the type of hardware you are running on your system or the software you are going to run. An operating system that is stable for one user might not be stable for another. When looking for a new stable OS for your system you should go for the one which has the LTS or stable version tag.

The post Top 5 Most Stable Linux Distributions in 2022 appeared first on TecAdmin.

]]>
https://tecadmin.net/best-stable-linux-distributions/feed/ 7
How To Install PIP on Debian 11 Linux https://tecadmin.net/how-to-install-pip-on-debian-11/ https://tecadmin.net/how-to-install-pip-on-debian-11/#respond Fri, 01 Oct 2021 13:33:00 +0000 https://tecadmin.net/?p=27915 Pip is a popular package management tool for Python. It allows the Python developers to install and manage additional Python libraries in their applications. This is a similar application to nvm for Node.js and composer for PHP. Pip stands for Preferred Installer Program. Rather than a package management utility, Pip can create a completely isolated [...]

The post How To Install PIP on Debian 11 Linux appeared first on TecAdmin.

]]>
Pip is a popular package management tool for Python. It allows the Python developers to install and manage additional Python libraries in their applications. This is a similar application to nvm for Node.js and composer for PHP. Pip stands for Preferred Installer Program.

Rather than a package management utility, Pip can create a completely isolated environment for the Python application. In this tutorial, you will learn about the installation of Pip on the Debian 11 Linux system.

Prerequisites

This tutorial assuming that you already have installed Python 3 on your system. Next login to the Debian 11 system with sudo privileged account access.

Users have fresh installed Debian 11, can follow the initial server setup instructions.

Installing Pip for Python 3

You need to install separate Pip versions for Python3 and Python2. As you already have Python3 installed your system. Open a terminal with a sudo privileged account and run the below command to install Pip for Python3 on Debian 11 Linux system.

The following command will install Pip3 for Python3:

sudo apt update 
sudo apt install python3-pip 

Once the installation is completed successfully, check the Pip3 version by executing:

pip3 -V 
Output:
pip 20.3.4 from /usr/lib/python3/dist-packages/pip (python 3.9)

You may see a different Pip3 version on your system. Now, Pip3 is ready to use on your system.

Installing Pip for Python 2

Python 2 is reached to end of life and is no more maintained. Also, it is not installed default on Debian 11 Linux. We suggest using Python 3 for your new applications.

But if your existing application still requires Python 2, then you can install it from default repositories. To install Python2.7 packages type:

sudo apt install python2 

Now, install Pip for Python 2. Use the following command to download the Pip2 installer on your system.

curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o /tmp/get-pip.py 

Then run the downloaded Python script with python2 binary.

sudo python2 /tmp/get-pip.py 

The above command will install and configure Pip for Python2 on your system. To verify the installation and check installed Pip2 version, type:

pip -V 
Output:
pip 20.3.4 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)

Conclusion

This tutorial helps you to install Pip for Python3 on Debian 11 Linux. Additionally provided the instructions for installing Pip for Python2. You can follow these instructions to create an isolated environment.

The post How To Install PIP on Debian 11 Linux appeared first on TecAdmin.

]]>
https://tecadmin.net/how-to-install-pip-on-debian-11/feed/ 0
How To Install MariaDB on Debian 11 https://tecadmin.net/how-to-install-mariadb-on-debian-11/ https://tecadmin.net/how-to-install-mariadb-on-debian-11/#comments Mon, 27 Sep 2021 13:58:46 +0000 https://tecadmin.net/?p=27882 MySQL is a well-liked free database management system and also a prominent component of the LAMP stack. MySQL has been replaced with MariaDB in Debian repositories, which is a decent alternative to MySQL and pretty much performs every operation that MySQL performs. MySQL is currently not available for Debian 11 Bullseye, so MariaDB is a [...]

The post How To Install MariaDB on Debian 11 appeared first on TecAdmin.

]]>
MySQL is a well-liked free database management system and also a prominent component of the LAMP stack. MySQL has been replaced with MariaDB in Debian repositories, which is a decent alternative to MySQL and pretty much performs every operation that MySQL performs.

MySQL is currently not available for Debian 11 Bullseye, so MariaDB is a perfect choice. This article is focusing on how to install MariaDB, an alternative to MySQL on Debian 11.

Install MariaDB on Debian 11

The MariaDB packages are available under the official repositories. You can directly install it without adding an extra repo to your system. For this tutorial, we will install MariaDB on Debian 11 system via default repositories.

Firstly, update the packages list using:

sudo apt update 

Now, to install MariaDB, execute the below-mentioned command:

sudo apt install mariadb-server 

Configure MariaDB on Debian

To configure MariaDB properly we need to run a security script using the below-mentioned command:

sudo mysql_secure_installation 

After running the above command, you will be prompted with various options:

Secure Installation wizzard 1

Secure Installation wizzard 2

The options are self-explanatory, for the first two options choose “n” and for the next sequence of options press “y” for yes.

Create Privileges User with Authentication

For security purposes, MariaDB uses a unix_socket plugin to authenticate the root user. This may cause complications therefore, it is recommended to set a new user with password-based access. And to create a new user login to MariaDB using:

sudo mysql  

Now create a new user with a password in the MariaDB server.

CREATE USER 'admin'@'localhost' IDENTIFIED BY '_pa$$w0rd_'; 

Make sure to change admin with your username and _pas$$w0rd_ with a new secure password.

Next, grant permissions on all databases to a newly created account. Here the GRANT OPTION allow a user to create other users and assign them permissions.

GRANT ALL ON *.* TO 'admin'@'localhost' WITH GRANT OPTION;  

Apply the new changes, execute:

FLUSH PRIVILEGES;  

And to quit typing “exit”.

EXIT 

The SQL statements are case insensitive, So you can write them in any case.

Connect MariaDB Server

One can manage MariaDB service using the Systemd. To test the status of MariaDB use the following command:

sudo systemctl status mariadb 

If for some reasons MariaDB is not running then use the below-mentioned command to start it:

sudo systemctl start mariadb 

For one more check you can try to connect to the database using:

sudo mysqladmin version 
Output
mysqladmin Ver 9.1 Distrib 10.5.11-MariaDB, for debian-linux-gnu on x86_64 Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Server version 10.5.11-MariaDB-1 Protocol version 10 Connection Localhost via UNIX socket UNIX socket /run/mysqld/mysqld.sock Uptime: 3 hours 45 min 24 sec Threads: 1 Questions: 497 Slow queries: 0 Opens: 171 Open tables: 28 Queries per second avg: 0.036

Next, connect to the MySQL shell by using the credentials created in the above step.

mysql -u admin -p 

The output of the above command asks for the password; use the password you set in the above steps. On successful authentication, you will get the MariaDB shell as below:

Output
Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 60 Server version: 10.5.11-MariaDB-1 Debian 11 Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]>

Conclusion

MariaDB is an open-source alternative to MySQL in the latest version of Debian. This write-up is a guide to install MariaDB on Debian 11 Bullseye. We learned how to install and configure MariaDB on Debian 11. We also created a separate user to manage the database with password access. Finally, we also discussed utilities to test the MariaDB status.

The post How To Install MariaDB on Debian 11 appeared first on TecAdmin.

]]>
https://tecadmin.net/how-to-install-mariadb-on-debian-11/feed/ 2
How To Install Node.Js on Debian 11 https://tecadmin.net/how-to-install-node-js-on-debian-11/ https://tecadmin.net/how-to-install-node-js-on-debian-11/#respond Sun, 19 Sep 2021 06:45:02 +0000 https://tecadmin.net/?p=27794 NodeJs is a JavaScript framework that allows users to easily develop autonomous network applications for general-purpose programming. NodeJs is free to make web application development more uniform and integrated through the use of JavaScript on both the front and back ends. It is available for all Operating Systems; in this article, you will learn how [...]

The post How To Install Node.Js on Debian 11 appeared first on TecAdmin.

]]>
NodeJs is a JavaScript framework that allows users to easily develop autonomous network applications for general-purpose programming. NodeJs is free to make web application development more uniform and integrated through the use of JavaScript on both the front and back ends.

It is available for all Operating Systems; in this article, you will learn how to install NodeJs on your Debian system (Linux OS) so that you can build amazing applications using NodeJs.

Given below are three methods to install NodeJs on Debian 11, you can follow any of these you find easier for successful installation:

Method 1 – Installing Nodejs from Debian Repository

At the time of writing this tutorial, the Node.js 12.22.5 version is available under default repositories. To get this version of NodeJs on your Debian system follow the steps mentioned below:

  1. Update Packages – First update all the packages previously installed in the System by below mentioned command:
    sudo apt update 
    
  2. Install Nodejs and NPM – The “npm” is the package manager of NodeJs, run the below mentioned command to install NodeJs and npm on Debian 11:
    sudo apt install nodejs npm 
    
  3. Check Version – To verify the correct version installation of NodeJs, run the below mentioned command to check version number of recently installed NodeJs:
    node -v 
    
    Output:
    v12.22.5

Method 2 – How to install NodeJs using NodeSource PPA

You can use a PPA (Personal Package Archive) provided by NodeSource to operate with the latest version of NodeJs. This is an alternative repository containing ‘Apt’ and contains current versions than the official Debian repositories for NodeJs.

Follow the steps below for successful installation of NodeJs using PPA:

  1. Install PPA – To install NodeJs Package using “Apt”, add the repository to Package list using below-mentioned syntax:

    curl -sL https://deb.nodesource.com/setup_[version_number] -o nodesource_setup.sh

    You can replace “version number” with the version you want to install, here I am installing stable version “16.x” by below mentioned command:

    curl -sL https://deb.nodesource.com/setup_16.x -o nodesource_setup.sh 
    
  2. Configure NodeSource setup – Run the below mentioned to inquire newly downloaded script, it will open a file and after inspecting the file press Ctrl+X to exit the file and return to terminal:
    nano nodesource_setup.sh 
    
  3. Run the Script – After configuring the script, run the script using below mentioned command:
    sudo bash nodesource_setup.sh 
    

    The PPA is added to your settings and the local package cache is instantly updated.

  4. Install NodeJs – Now after adding PPA, install NodeJs using below mentioned command, we don’t need to install npm separately here as it is already included in package:
    sudo apt install nodejs 
    
  5. Check Version – Now verify installation by checking version number of NodeJs:
    node -v 
    
    Output:
    v16.14.0

    Also check version of npm to verify its installation with NodeJs:

    npm -v 
    
    Output:
    8.3.1
  6. Installing “build-essential” – To get the needy tools to work with npm package, run the below mentioned command:
    sudo apt install build-essential 
    

Method 3 – Installing NodeJs using NVM on Debian 11

Node Version Manager, abbreviated as NVM, can also be used to install NodeJs on Debian. Instead of functioning in the operating system, NVM operates in the home directory of your user at the level of an independent directory. In other words, without impacting the overall system, you may install numerous autonomous NodeJs versions.
You may use NVM to control your environment while maintaining and handling prior releases in the latest NodeJs versions.

Follow the steps given below to install NodeJs using NVM:

  1. Download NVM installation script – Firstly, from the GitHub link download the nvm installation script by the below-mentioned command:
    curl -sL https://raw.githubusercontent.com/creationix/nvm/master/install.sh -o install_nvm.sh 
    
  2. Configure script – Using nano command, inquire the downloaded script by below mentioned command:
    nano install_nvm.sh 
    

    After checking the file, if everything seems good then exit the editor by pressing Ctrl+X.

  3. Run the script – After configuring the file, run the downloaded script:
    bash install_nvm.sh 
    
  4. Gain Access to NVM Functionality – Running NVM script will add additional setup to “~/ .profile” , allowing the new program, you will either log out or log in back; reload “~/ .profile” file using:
    source ~/.profile 
    
  5. Install NodeJs from available versions on NVM –
    First, we can check which versions of NodeJs are available on NVM by below mentioned command:

    nvm ls-remote 
    

    Now choose the version number you want to install from list, Syntax: nvm install [version-number]

    I am going to install version 16.14.0, so replace [version-number] with 16.14.0:

    nvm install 16.14.0 
    

    In general, the latest version is used by nvm, you need to tell nvm to use the version you downloaded by below mentioned command:

    nvm use 16.14.0 
    
  6. Check Version – You can check the version of NodeJs installed using:
    node -v 
    
    Output:
    v16.14.0

    If you are having many node versions installed on your system, to check recently installed version, run the below mentioned command:

    nvm ls 
    
    Output:
    -> v16.14.0 system default -> 16.14.0 (-> v16.14.0) iojs -> N/A (default) unstable -> N/A (default) node -> stable (-> v16.14.0) (default) stable -> 16.14 (-> v16.14.0) (default) lts/* -> lts/gallium (-> v16.14.0) lts/argon -> v4.9.1 (-> N/A) lts/boron -> v6.17.1 (-> N/A) lts/carbon -> v8.17.0 (-> N/A) lts/dubnium -> v10.24.1 (-> N/A) lts/erbium -> v12.22.10 (-> N/A) lts/fermium -> v14.19.0 (-> N/A) lts/gallium -> v16.14.0

Set Default Version of NodeJs using NVM

If you want to set any version as default, type the below-mentioned syntax: nvm alias default [version-number]

I am going to default version v16.14.0 so replace [version-number] with v16.14.0:

nvm alias default 16.14.0 

Test NodeJs

We can check whether our installed NodeJs is working or not; make sample JavaScript file using nano command:

nano sample.js 

The file will be opened in the editor now enter the below-shown content in the file to print “Hello World” on Terminal. Press Ctrl+O to save file and press Ctrl+X to exit file:

const http = require(‘http’);
const hostname = ‘localhost’;
const port = 3000;

const server = http.createServer((req, res) => {
  res.statusCode = 200;
  res.setHeader(‘Content-Type’, ‘text/plain’);
  res.end(‘Hello World\n’);
});
  server.listen(port, hostname, () => {
  console.log(‘Server running at http://${hostname}:${port}/’);
});

Now to start application run below mentioned command:

node sample.js 
Output:
Server running at http://localhost:3000

Run below mentioned command to test application on another terminal:

curl http://localhost:3000 

How to uninstall NodeJs from Debian 11 Bullseye

Depending on the version you wish to target, you can remove NodeJs with apt or NVM You will need to deal with the apt program on the system level to uninstall versions installed from the Debian repository or from PPA.
To uninstall any of version, run the below mentioned command:

sudo apt remove nodejs 

If you wanted to uninstall version of NodeJs installed from NVM, for that first check the current version of NodeJs installed by below mentioned command:

nvm current 

Then run the below-mentioned syntax to uninstall any specific version of NodeJs installed using NVM on your system:

nvm uninstall [version-number]

I am uninstalling current version of NodeJs, so first I need to deactivate NVM:

nvm deactivate 

Now run the command:

nvm uninstall 12.1.0 

Conclusion

NodeJs is a server-side framework to build JavaScript apps. It is used for both back-end and front-end programming. In this article, we discuss its installation on Debian 11 using three methods which are using Debian’s official Repository, through PPA Repository, and also through NVM and also discuss its testing and uninstallation from the system.

The post How To Install Node.Js on Debian 11 appeared first on TecAdmin.

]]>
https://tecadmin.net/how-to-install-node-js-on-debian-11/feed/ 0
How To Add Swap Space on Debian 11 https://tecadmin.net/how-to-add-swap-space-on-debian-11/ https://tecadmin.net/how-to-add-swap-space-on-debian-11/#respond Sat, 11 Sep 2021 05:16:47 +0000 https://tecadmin.net/?p=27715 Swap memory is a location on hard disk to be used as Memory by the operating system. When the operating systems detects that main memory is low and required more RAM to run applications properly it check for swap space and transfer files there. In general terms, swap is a part of the hard disk [...]

The post How To Add Swap Space on Debian 11 appeared first on TecAdmin.

]]>
Swap memory is a location on hard disk to be used as Memory by the operating system. When the operating systems detects that main memory is low and required more RAM to run applications properly it check for swap space and transfer files there. In general terms, swap is a part of the hard disk used as RAM on the system.

This tutorial will help you to Add Swap on Debian 11 Bullseye Linux system.

How to Create Swap in Debian 11

Use the below steps to create and enable Swap memory on your Debian 11 system via command line.

  1. First of all, Check that no Swap memory is enabled on your system. You can see the swap memory details by running the following commands.
    sudo swapon -s 
    free -m 
    

    Check Available Swap Memory
    Check Available Swap Memory
  2. Now, create a file to use as swap in your system system. Make sure you have enough free disk available to create new file. Also keep the swap just up to 2x of the memory on your system.

    My Debian system have 2GB of main memory. So we will create a swapfile of 4GB in size.

    sudo fallocate -l 4G /swapfile 
    chmod 600 /swapfile 
    
  3. Now use the mkswap command to convert file to use for swap memory.
    sudo mkswap /swapfile 
    
  4. Then activate the swap memory on your system.
    sudo swapon /swapfile 
    
  5. You have successfully added swap memory to your system. Execute one of the below commands to view current active swap memory on your system:
    sudo swapon -s 
    free -m 
    

    add swap on ubuntu
    Swap is Added to your System

Make Swap Permanent

After running above commands, Swap memory is added to your system and operating system can use when required. But after reboot of system swap will deactivate again.

You can make it permanent by appending the following entry in /etc/fstab file. Edit fstab file in editor:

vim /etc/fstab 

and add below entry to end of file:

/swapfile   none    swap    sw    0   0

Add swap in fatab

Save file and close. Now Swap memory will remain activate after system reboots.

Configure Swappiness

Now change the swappiness kernel parameter as per your requirement. It tells the system how often system utilize this swap area.

Edit /etc/sysctl.conf file:

sudo vim /etc/sysctl.conf 

append following configuration to end of file

vm.swappiness=10

Now reload the sysctl configuration file

sudo sysctl -p 

Conclusion

Now the operating system can use swap memory in case of low physical memory. In this tutorial, you have learned to create and enable Swap memory on Debian 11 Linux system.

The post How To Add Swap Space on Debian 11 appeared first on TecAdmin.

]]>
https://tecadmin.net/how-to-add-swap-space-on-debian-11/feed/ 0
How To Install Anaconda on Debian 11 https://tecadmin.net/how-to-install-anaconda-on-debian-11/ https://tecadmin.net/how-to-install-anaconda-on-debian-11/#respond Fri, 10 Sep 2021 10:55:01 +0000 https://tecadmin.net/?p=27685 Anaconda is an open-source platform written with Python programming language. It was built by data scientists, for data scientists. Anaconda contains a large variety of packages and repositories. It is important in its functionality as it provides processing and computing data on a large scale and also to program in python language. The Anaconda is [...]

The post How To Install Anaconda on Debian 11 appeared first on TecAdmin.

]]>
Anaconda is an open-source platform written with Python programming language. It was built by data scientists, for data scientists. Anaconda contains a large variety of packages and repositories. It is important in its functionality as it provides processing and computing data on a large scale and also to program in python language. The Anaconda is a good platform to program python applications.

This article helps you to install Anaconda on your Debian 11 (Bullseye) Linux system with easy instructions.

Prerequisites

First of all, open terminal on your Debian system and execute the command mentioned below to update packages repository:

sudo apt update && sudo apt install curl -y 

Step 1 – Prepare the Anaconda Installer

Now I will go to the /tmp directory and for this purpose, we will use the cd command.

cd /tmp 

Next, use the curl command line utility to download the Anaconda installer script from the official site. Visit the Anaconda installer script download page to check for the latest versions. Then, download the script as below:

curl --output anaconda.sh https://repo.anaconda.com/archive/Anaconda3-2022.05-Linux-x86_64.sh 

To check the script SHA-256 checksum, I will use this command with the file name, though this step is optional:

sha256sum anconda.sh 
Output:
a7c0afe862f6ea19a596801fc138bde0463abcbce1b753e8d5c474b506a2db2d anaconda.sh

Check if the hash code matching with the code shown on the download page.

Step 2 – Installing Anaconda on Debian 11

Your system is ready to install Anaconda. Let’s move to the text step and execute the Anaconda installer script as below:

bash anaconda.sh 

Follow the wizard instructions to complete Anaconda installation process. You need to provide inputs during installation process as described below:

    01. Use above command to run the downloaded installer script with the bash shell.

    Begin the Anaconda Installation on Debian 11
    Begin the Anaconda Installation

    02. Type “yes” to accept the Anaconda license agreement to continue.

    Accept License Agreement in Conda Installer
    Accept License Agreement

    03. Verify the Anaconda installation directory location and then just hit Enter to continue installer to that directory.

    Continue Anaconda Installation
    Continue the Anaconda Installer Process

    04. Type “yes” to initialize the Anaconda installer on your system.

    Intialize Anaconda during Installation
    Intialize Anaconda during Installation

    05. You will see the below message on successful Anaconda installation on Debian 11 system.

    Anacond Installation Completed on Debian 11
    Anacond Installation Completed Successfully

Anaconda has been successfully installed on Debian Linux. The installer script has added the environment configuration in .bashrc file of current logged in user.

Use the following command to activate the Anaconda environment:

source ~/.bashrc 

Now we are in the default base of the programming environment. To verify the installation we will open conda list.

conda list 
Output:
# packages in environment at /home/tecadmin/anaconda3: # # Name Version Build Channel _ipyw_jlab_nb_ext_conf 0.1.0 py38_0 _libgcc_mutex 0.1 main alabaster 0.7.12 pyhd3eb1b0_0 anaconda 2021.05 py38_0 anaconda-client 1.7.2 py38_0 anaconda-navigator 2.0.3 py38_0 anaconda-project 0.9.1 pyhd3eb1b0_1 anyio 2.2.0 py38h06a4308_1 appdirs 1.4.4 py_0

How to Update Anaconda

You can easily update the Anaconda and packages using the conda binary. To upgrade the Anaconda on your system, type:

conda update --all 
Output:
Proceed ([y]/n)? y

Press “y” to proceed with the update process. The output will show you all the packages that are newly installed, or upgrading current packages, and the removal of unnecessary packages.

Conclusion

You can use Anaconda to manage scientific computing, workloads for data science, analytics, and large-scale data processing. In this article, we have learned how to install anaconda on Debian 11 “Bullseye” from its original source.

The post How To Install Anaconda on Debian 11 appeared first on TecAdmin.

]]>
https://tecadmin.net/how-to-install-anaconda-on-debian-11/feed/ 0