❌

Normal view

There are new articles available, click to refresh the page.
Before yesterdayMain stream

LAMP stack installation Day 16

26 February 2024 at 08:38

Popular open stack for web development – LAMP. Click Here to read documentation.


Apache installation

sudo apt update -y

sudo apt install apache2 apache2-utils -y

sudo systemctl start apache2

sudo systemctl enable apache2

sudo systemctl status apache2

sudo apache2 -v

Providing access to Apache user (Default user) for document root

sudo chown -R www-data:www-data /var/www/html


Installing MariaDB

sudo apt install mariadb-server mariadb-client

sudo systemctl start mariadb

sudo systemctl enable mariadb

sudo systemctl status mariadb

creating root password for mariadb


mysql_secure_installation
Enter current password for root (enter for none): enter
Set 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

login to mariadb

mariadb -u root -p


PHP installation

sudo add-apt-repository ppa:ondrej/php

sudo apt update
sudo apt install php8.2 libapache2-mod-php8.2 php8.2-mysql php-common php8.2-cli php8.2-common php8.2-opcache php8.2-readline php-json


Enable the Apache php8.2 module

a2enmod php8.2

Check the version

php –version

Restart the apache server

sudo systemctl restart apache2


Test with php test page

Create a test page

sudo vim /var/www/html/info.php
<?php phpinfo(); ?>
:wq!
save and exit

http://localhost/info.php or http://127.0.0.1/info.php


LAMP stack installation Day 16

26 February 2024 at 08:38

Popular open stack for web development – LAMP. Click Here to read documentation.


Apache installation

sudo apt update -y

sudo apt install apache2 apache2-utils -y

sudo systemctl start apache2

sudo systemctl enable apache2

sudo systemctl status apache2

sudo apache2 -v

Providing access to Apache user (Default user) for document root

sudo chown -R www-data:www-data /var/www/html


Installing MariaDB

sudo apt install mariadb-server mariadb-client

sudo systemctl start mariadb

sudo systemctl enable mariadb

sudo systemctl status mariadb

creating root password for mariadb


mysql_secure_installation
Enter current password for root (enter for none): enter
Set 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

login to mariadb

mariadb -u root -p


PHP installation

sudo add-apt-repository ppa:ondrej/php

sudo apt update
sudo apt install php8.2 libapache2-mod-php8.2 php8.2-mysql php-common php8.2-cli php8.2-common php8.2-opcache php8.2-readline php-json


Enable the Apache php8.2 module

a2enmod php8.2

Check the version

php –version

Restart the apache server

sudo systemctl restart apache2


Test with php test page

Create a test page

sudo vim /var/www/html/info.php
<?php phpinfo(); ?>
:wq!
save and exit

http://localhost/info.php or http://127.0.0.1/info.php


Day 7 – notes

13 February 2024 at 06:44

Today we have seen step by step instructions to install apache2 webserver on our linux machines.

  • apache2
  • nginx
  • IIS
  • httpd

These are some common webserver applications being widely used around the world. In this sessio, we have seen how to install apache2 on debian based OS machine.

apache2 is a webserver daemon application(kind of background processes that start at system boot and continue running until the system is shut down)

sudo apt install apache2 -y

Above command install apache2 on our machine. The argument -y is added in the same command to pass it when the terminal prompts for an answer.

After installation, if incase the system is restarted, by default the apache2 service would be in β€˜disabled’ state. So, in order to keep it active always at any time although if restart occurs, we need to use below command.

sudo systemctl enable apache2
sudo systemctl status apache2

This command is used to check if apache2 webserver’s status or to check if it is installed.

To check in which port the apache2 webserver is running, use command as below

It shows the application is running in port 80

By default – post apache2 installation, if we try β€œlocalhost” in browser, it will display index page of apache2 that is present in /var/www/index.html

We have seen how to edit that html through vim and how to keep custom html page.

Post editing html – when we invoke β€œlocalhost” the updated html page is visible in browser. Moreover, the same html content can be seen in the terminal through below command

We have also seen how to install such application in WAN. Dhanasekar showed how to procure a cloud machine from linode akamai website. I will try the same after some time.

We have see how to transfer a file from localmachine to remote machine using scp command. As per below screenshot – the index.html file from local machine has been transferred to remote machine to display the home page when apache2 server runs in remote machine.

Below commands can be used to start/stop the webserver

systemctl start apache2
systemctl stop apache2
systemctl restart apache2

Install / Uninstall Apache server in Linux

By: Gowtham G
8 February 2024 at 13:41

Here,we are going to discuss about how to install apache server in debian.

sudo apt update
sudo apt install apache2

Once,the packages are installed in your system.Run the server by the following command.

sudo systemctl start apache2

Now you can check the status whether it is running or not by using..,

sudo systemctl status apache2

Active: active (running) since Thu 2024-02-08 18:37:49 IST; 11s ago
You can check that it is running.Also there is a another method to check by entering http://localhost/ in any of your browser.

sudo systemctl enable apache2

If you don’t want to start every time and by default the server should be on running,use the above command.It starts automatically when the system boots.

sudo systemctl stop apache2

This command will stop the server.

sudo systemctl disable apache2

This will disable the server and is not running after the system boots.

Now,we can see how to remove apache server.

sudo apt remove --purge apache2

This will remove the apache2 server from your system.

sudo apt autoremove

This command is used to remove the apache related dependencies automatically from the system.

That’s it…

❌
❌