Contents
  1. 1. I. Basic concepts
    1. 1.1. Package Management on Operating Systems
      1. 1.1.1. Debian/Ubuntu Package Management
      2. 1.1.2. CentOS/RHEL Package Management
      3. 1.1.3. Windows Package Management
      4. 1.1.4. MacOS Package Management
    2. 1.2. Service Manager
      1. 1.2.1. Systemd
  2. 2. II. Software Installation
  3. 3. JDK/JRE
    1. 3.1. Debian/Ubuntu/Deepin
      1. 3.1.1. Install openjdk from Official APT Repositories
  4. 4. Maven
    1. 4.1. CentOS/RHEL
      1. 4.1.1. Install from the EPEL YUM repository
  5. 5. Python
    1. 5.1. Debian/Ubuntu
      1. 5.1.1. Install from the official APT repository
    2. 5.2. CentOS/RHEL
      1. 5.2.1. Install from the Official YUM repository
  6. 6. Node.js
    1. 6.1. CentOS/RHEL
      1. 6.1.1. Install from the EPEL YUM repository
  7. 7. Redis
    1. 7.1. Linux
      1. 7.1.1. Install from Snapcraft
    2. 7.2. Debian/Ubuntu/Deepin
      1. 7.2.1. Install from the official APT repositories
      2. 7.2.2. Install from the Redis APT repository
    3. 7.3. CentOS/RHEL
      1. 7.3.1. Install from the EPEL YUM repository
    4. 7.4. Windows
    5. 7.5. Install from Source
  8. 8. MySQL
    1. 8.1. Linux
    2. 8.2. Windows
  9. 9. Elasticsearch
  10. 10. Kibana
    1. 10.1. CentOS/RHEL
      1. 10.1.1. Install from the elastic YUM repository
      2. 10.1.2. Install by downloading RPM file
  11. 11. Nginx
  12. 12. Apache Tomcat
  13. 13. Docker
    1. 13.1. Debian/Ubuntu/Deepin
      1. 13.1.1. Install from the Docker APT repository
  14. 14. References

I. Basic concepts

Package Management on Operating Systems

Debian/Ubuntu Package Management

Advanced Packaging Tool – APT

apt-get is a command line tool for interacting with the Advanced Package Tool (APT) library (a package management system for Linux distributions). It allows you to search for, install, manage, update, and remove software.

Configuration of the APT system repositories is stored in the /etc/apt/sources.list file and the /etc/apt/sources.list.d directory. You can add additional repositories in a separate file in the /etc/apt/sources.list.d directory, for example, redis.list, docker.list.

dpkg

dpkg is a package manager for Debian-based systems. It can install, remove, and build packages, but unlike other package management systems, it cannot automatically download and install packages – or their dependencies. APT and Aptitude are newer, and layer additional features on top of dpkg.

1
2
3
4
# install
sudo dpkg -i package_file.deb
# uninstall
sudo apt-get remove package_name

CentOS/RHEL Package Management

Yellow Dog Updater, Modified (YUM)

YUM is the primary package management tool for installing, updating, removing, and managing software packages in Red Hat Enterprise Linux. YUM performs dependency resolution when installing, updating, and removing software packages. YUM can manage packages from installed repositories in the system or from .rpm packages. The main configuration file for YUM is at /etc/yum.conf, and all the repos are at /etc/yum.repos.d.

1
2
3
4
5
6
# add repos config to /etc/yum.repos.d
...
# clear repo cache
yum clean all
# create repo cache
yum makecache
1
2
3
4
5
6
7
8
9
10
11
# search package
yum search {package_name}

# upgrade package
yum update

# install package
yum install {package_name}

# uninstall package
yum remove {package_name}

RPM (RPM Package Manager)

RPM is a popular package management tool in Red Hat Enterprise Linux-based distros. Using RPM, you can install, uninstall, and query individual software packages. Still, it cannot manage dependency resolution like YUM. RPM does provide you useful output, including a list of required packages. An RPM package consists of an archive of files and metadata. Metadata includes helper scripts, file attributes, and information about packages.

1
2
3
4
5
6
7
8
# install
sudo rpm -i package_file.rpm
sudo rpm --install package_file.rpm
# reinstall
sudo rpm --reinstall package_file.rpm
# uninstall
sudo rpm -e package_name
sudo rpm --erase package_name

Windows Package Management

Chocolatey

winget

Microsoft Store

MacOS Package Management

brew

Mac App Store

Service Manager

Systemd

II. Software Installation

JDK/JRE

Headless version

Headless is the same version than the latter without the support of keyboard, mouse and display systems. Hence it has less dependencies and it makes it more suitable for server application.

Debian/Ubuntu/Deepin

Install openjdk from Official APT Repositories

Supported Operating Systems

  • Ubuntu/Debian
  • Deepin

Installing

1
2
3
4
# insall
sudo apt-get install openjdk-8-jdk
# verify. If the installation was successful, you can see the Java version.
java -version

Installing Options

  • openjdk-8/11/17-jdk
  • openjdk-8/11/17-jdk-headless
  • openjdk-8/11/17-jre
  • openjdk-8/11/17-jre-headless

Maven

CentOS/RHEL

Install from the EPEL YUM repository

1
2
3
4
5
6
7
# Add the EPEL repository, and update YUM to confirm your change
sudo yum install epel-release
sudo yum update
# install
sudo yum install maven -y
# verify
mvn -v

Add Aliyun Mirror. Add the following lines to the tag <mirrors> in the /etc/maven/settings.xml

1
2
3
4
5
6
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>

Python

Debian/Ubuntu

Install from the official APT repository

1
2
3
4
5
6
# Update the environment
sudo apt update
# install
sudo apt install python3 -y
# verify
python3 -V

CentOS/RHEL

Install from the Official YUM repository

1
2
3
4
5
6
# Update the environment. Make sure that we are working with the most up to date environment possible in terms of our packages
sudo yum update -y
# install
sudo yum install -y python3
# verify
python3 -V

Node.js

CentOS/RHEL

Install from the EPEL YUM repository

1
2
3
4
5
6
7
# Add the EPEL repository, and update YUM to confirm your change
sudo yum install epel-release
sudo yum update
# install
sudo yum install nodejs
# verify
node --version

Redis

Linux

Install from Snapcraft

The Snapcraft store provides Redis packages that can be installed on platforms that support snap. Snap is supported and available on most major Linux distributions.

1
sudo snap install redis

If your Linux does not currently have snap installed, install it using the instructions described in Installing snapd.

Debian/Ubuntu/Deepin

Install from the official APT repositories

1
2
sudo apt-get update
sudo apt-get install redis-server

Update config

1
sudo vim /etc/redis/redis.conf

Uncomment the following line

1
# supervised auto

to

1
supervised auto

Enable and restart Redis service

1
2
sudo systemctl enable redis.service
sudo systemctl restart redis.service

Verify

1
2
systemctl status redis
redis-cli ping

Install from the Redis APT repository

Most major Linux distributions provide packages for Redis.

1
2
# prerequisites
sudo apt install lsb-release curl gpg
1
2
3
4
5
6
7
8
9
10
11
12
# add the repository to the apt index, update it. and then install redis. 

curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg

echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list

sudo apt-get update
sudo apt-get install redis

# verify
systemctl status redis
redis-cli ping

CentOS/RHEL

Install from the EPEL YUM repository

  1. Add the EPEL repository, and update YUM to confirm your change:

    1
    2
    sudo yum install epel-release
    sudo yum update
  2. Install Redis:

    1
    sudo yum install redis
  3. Start Redis:

    1
    sudo systemctl start redis

    Optional: To automatically start Redis on boot:

    1
    sudo systemctl enable redis

Verify the Installation

Verify that Redis is running with redis-cli:

1
redis-cli ping

If Redis is running, it will return:

1
PONG

Windows

Redis is not officially supported on Windows.

Install from Source

Supported Operating Systems

  • All Linux distros (distributions)
  • MacOS

You can compile and install Redis from source on variety of platforms and operating systems including Linux and macOS. Redis has no dependencies other than a C compiler and libc.

1
2
3
4
5
6
7
8
# Download source files
wget https://download.redis.io/redis-stable.tar.gz
# Compiling
tar -xzvf redis-stable.tar.gz
cd redis-stable
make
# make sure the build is correct
make test

If the compile succeeds, you’ll find several Redis binaries in the src directory, including:

  • redis-server: the Redis Server itself
  • redis-cli is the command line interface utility to talk with Redis.

Starting and stopping Redis

1
2
3
4
5
6
7
8
9
10
11
cd redis-stable
# starting redis server
./src/redis-server &
# starting redis server with config
./src/redis-server redis.conf &
# stopping redis server
ps -ef | grep redis-server | awk '{print $2}' | head -1 | xargs kill -9
# connect to redis
./src/redis-cli
# auth
127.0.0.1:6379> auth YOUR_PASSWORD

update password in redis.conf

1
# requirepass foobared

to

1
requirepass YOUR_STRONG_PASSWORD

Manage Redis service using systemd

Create the /etc/systemd/system/redis.service file, and add the following line to the file

1
2
3
4
5
6
7
8
9
10
11
[Unit]
Description=Redis
After=network.target

[Service]
ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf
ExecStop=/usr/local/bin/redis-cli shutdown
Restart=always

[Install]
WantedBy=multi-user.target

copy the files

1
2
3
4
5
cd /path/to/redis/source/dir
sudo mkdir /etc/redis
sudo cp redis.conf /etc/redis/
sudo cp src/redis-server /usr/local/bin/
sudo cp src/redis-cli /usr/local/bin/

Edit config

1
sudo vim /etc/redis/redis.conf

Uncomment the following line

1
# supervised auto

to

1
supervised auto

Enable and start Redis service

1
2
3
systemctl enable redis
systemctl start redis
systemctl status redis

To verify Redis is up and running, run the following command:

1
redis-cli PING

MySQL

Linux

Windows

Elasticsearch

Kibana

CentOS/RHEL

Install from the elastic YUM repository

Download and install the public signing key:

1
rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch

Create a file called kibana.repo in the /etc/yum.repos.d/ directory for RedHat based distributions, or in the /etc/zypp/repos.d/ directory for OpenSuSE based distributions, containing:

1
2
3
4
5
6
7
8
[kibana-8.x]
name=Kibana repository for 8.x packages
baseurl=https://artifacts.elastic.co/packages/8.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md

You can now install Kibana with one of the following commands:

1
2
3
4
5
6
# older Red Hat based distributions
sudo yum install kibana
# Fedora and other newer Red Hat distributions
sudo dnf install kibana
# OpenSUSE based distributions
sudo zypper install kibana

Install by downloading RPM file

Downloading the Kibana RPM file

1
2
3
4
wget https://artifacts.elastic.co/downloads/kibana/kibana-8.8.2-x86_64.rpm
wget https://artifacts.elastic.co/downloads/kibana/kibana-8.8.2-x86_64.rpm.sha512
shasum -a 512 -c kibana-8.8.2-x86_64.rpm.sha512
sudo rpm --install kibana-8.8.2-x86_64.rpm

Start Elasticsearch and generate an enrollment token for Kibana

When you start Elasticsearch for the first time, the following security configuration occurs automatically:

  • Authentication and authorization are enabled, and a password is generated for the elastic built-in superuser.
  • Certificates and keys for TLS are generated for the transport and HTTP layer, and TLS is enabled and configured with these keys and certificates.

The password and certificate and keys are output to your terminal.

Run Kibana with systemd

To configure Kibana to start automatically when the system starts, run the following commands:

1
2
sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable kibana.service

Kibana can be started and stopped as follows:

1
2
sudo systemctl start kibana.service
sudo systemctl stop kibana.service

Log information can be accessed via journalctl -u kibana.service.

Configure Kibana via the config file

Kibana loads its configuration from the /etc/kibana/kibana.yml file by default. The format of this config file is explained in Configuring Kibana.

Nginx

Apache Tomcat

Docker

Debian/Ubuntu/Deepin

Install from the Docker APT repository

Set up the repository

  1. Update the apt package index and install packages to allow apt to use a repository over HTTPS
1
2
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
  1. Add Docker’s official GPG key:
1
2
3
4
5
6
7
8
9
10
sudo install -m 0755 -d /etc/apt/keyrings

# 中科大源 docker - debian/deepin
curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
# Official docker - debian
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
# Official docker - ubuntu
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

sudo chmod a+r /etc/apt/keyrings/docker.gpg
  1. Use the following command to set up the repository
1
2
3
4
5
6
7
8
9
10
11
12
# 中科大源 docker - debian/deepin
echo 'deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://mirrors.ustc.edu.cn/docker-ce/linux/debian buster stable' | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# Official docker - debian
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# Official docker - ubuntu
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Install Docker Engine

  1. Update the apt package index:
1
sudo apt-get update
  1. Install Docker Engine, containerd, and Docker Compose.
1
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
  1. Verify that the Docker Engine installation is successful by running the hello-world image
1
sudo docker run hello-world

View Docker version and status

1
2
docker version
systemctl status docker

References

Linux package management with YUM and RPM

Package management - Ubuntu

systemd.unit — Unit configuration

Installing Redis

Contents
  1. 1. I. Basic concepts
    1. 1.1. Package Management on Operating Systems
      1. 1.1.1. Debian/Ubuntu Package Management
      2. 1.1.2. CentOS/RHEL Package Management
      3. 1.1.3. Windows Package Management
      4. 1.1.4. MacOS Package Management
    2. 1.2. Service Manager
      1. 1.2.1. Systemd
  2. 2. II. Software Installation
  3. 3. JDK/JRE
    1. 3.1. Debian/Ubuntu/Deepin
      1. 3.1.1. Install openjdk from Official APT Repositories
  4. 4. Maven
    1. 4.1. CentOS/RHEL
      1. 4.1.1. Install from the EPEL YUM repository
  5. 5. Python
    1. 5.1. Debian/Ubuntu
      1. 5.1.1. Install from the official APT repository
    2. 5.2. CentOS/RHEL
      1. 5.2.1. Install from the Official YUM repository
  6. 6. Node.js
    1. 6.1. CentOS/RHEL
      1. 6.1.1. Install from the EPEL YUM repository
  7. 7. Redis
    1. 7.1. Linux
      1. 7.1.1. Install from Snapcraft
    2. 7.2. Debian/Ubuntu/Deepin
      1. 7.2.1. Install from the official APT repositories
      2. 7.2.2. Install from the Redis APT repository
    3. 7.3. CentOS/RHEL
      1. 7.3.1. Install from the EPEL YUM repository
    4. 7.4. Windows
    5. 7.5. Install from Source
  8. 8. MySQL
    1. 8.1. Linux
    2. 8.2. Windows
  9. 9. Elasticsearch
  10. 10. Kibana
    1. 10.1. CentOS/RHEL
      1. 10.1.1. Install from the elastic YUM repository
      2. 10.1.2. Install by downloading RPM file
  11. 11. Nginx
  12. 12. Apache Tomcat
  13. 13. Docker
    1. 13.1. Debian/Ubuntu/Deepin
      1. 13.1.1. Install from the Docker APT repository
  14. 14. References