Kategorie: Linux

Full installation of Linux LAMP server, Apache, MySql, PHP Debian 11

This tutorial describes how to comprehensively install a LAMP server or Apache basic services, MySql, Php and phpmyadmin.

We will install all packages step by step.

First, we will install the Apache web server:

apt-get install apache2 apache2-utils -y

command:

apache2 -v

We can check the Apache version:

Server version: Apache/2.4.48 (Debian)
Server built:   2021-08-12T11:51:47

We run Apache with commands:

systemctl start apache2
systemctl enable apache2

After going to our ip address in the browser, we should see the Apache start page

The next step is to install the MariaDB database server

We install:

apt-get install mariadb-server -y

And we run:

systemctl start mariadb
systemctl enable mariadb

We can verify the operation status by issuing an order:

systemctl status mariadb

below the result:

? mariadb.service - MariaDB 10.3.31 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2021-08-21 04:13:25 UTC; 1min 36s ago
       Docs: man:mysqld(8)
             https://mariadb.com/kb/en/library/systemd/
   Main PID: 1838 (mysqld)
     Status: "Taking your SQL requests now..."
      Tasks: 31 (limit: 2353)
     Memory: 66.1M
     CGroup: /system.slice/mariadb.service
             ??1838 /usr/sbin/mysqld

We issue a command in the console:

mysql_secure_installation

And we do the initial configuration as below:

Enter current password for root (enter for none): 
Change the root password? [Y / N] Y
New password: 
Re-enter new password: 
Remove anonymous users? [Y / N] Y
Disallow root login remotely? [Y / N] Y
Remove test database and access to it? [Y / N] Y
Reload privilege tables now? [Y / N] Y

You can log into mysql by issuing a command:

mysql -u root -p

And by entering the password we have just set.

We can install PHP by issuing the command:

apt-get install php libapache2-mod-php php-cli php-mysql php-zip php-curl php-xml -y

We can check the php version by entering the command in the console:

php -v

the result of the:

PHP 7.4.21 (cli) (built: Jul  2 2021 03:59:48) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.21, Copyright (c), by Zend Technologies

The last step is to create our domain vhost.

We create a directory of our domain:

mkdir /var/www/html/domena.pl

we grant powers:

chown -R www-data:www-data /var/www/html/domena.pl

We create the vhost configuration file by issuing the command:

nano /etc/apache2/sites-available/domena.pl.conf

The content:

    ServerAdmin webmaster@localhost
    ServerName domena.pl
    DocumentRoot /var/www/html/domena.pl
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

And we save the file.

We add our vhost to active:

a2ensite domena.pl.conf
a2dissite 000-default

We check the configuration:

apache2ctl configtest

And we're reloading the Apache server:

systemctl reload apache2

The only thing left for us to do now is redirect the domain to the ip of our server.

Linux

Udostępnij
Opublikowane przez
Linux

Recent posts

KeePass2 2.52 w Ubuntu 22.04

The guide below describes how to install KeePass on Ubuntu. Całość wykonamy za pomocą kilku poleceń

2 years temu

Installing Master PDF editor in Ubuntu 22.04

Master PDF Editor is a comprehensive PDF program, which includes many features. Oprócz tworzenia i edycji

2 years temu

iotop - memory monitoring

Iotop jest prostym narzędziem dla systemów Uniksowych umożliwiającym monitorowanie użycia dowolnego nośnika pamięci flash/hdd/ssd w

2 years temu

Run multiple commands in one cron job

You can separate two or more commands with semicolons (;), Semicolon (;): służy do oddzielania

2 years temu

Changing the exif data of a photo in the Linux terminal

Poniższy poradnik opisuje w jaki sposób za pomocą konsoli możemy dokonać edycji danych zdjęcia exif.

2 years temu

Installing Rocket.Chat Server on Rocky Linux 8

The following guide describes how to install Rocket.Chat on Rocky Linux 8 Całość bardzo prosto zainstalujemy

2 years temu