Wednesday, May 27, 2020

How To Setup (SSH , FTP , Webmin , LAMP, PHPMyAdmin ) On Ubuntu 20.04 LTS

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

SSH, or Secure Shell, is a remote administration protocol that allows users to control and modify their remote servers over the Internet.


FTP is short for File Transfer Protocol.

Offcial Wesbite - https://security.appspot.com/vsftpd.html


Webmin is a web-based interface for system administration for Unix.

Website - http://www.webmin.com/


LAMP is a well-known abbreviation for Linux, Apache, MySQL, and PHP.


PhpMyAdmin is an open-source PHP application designed to handle the administration of MySQL and MariaDB servers over a web-based interface.

Offcial wesbite - https://www.phpmyadmin.net/

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Testing Environment: Ubuntu 20.04 LTS        Hostname - www.yourdomain.com         ip Address - 192.168.1.10

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Default ssh port - 22 | Vsftpd Default Port - 21 | Webmin default port - 10000

apt update ; apt install build-essential net-tools curl git software-properties-common neofetch


------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Setup SSH (Secure Shell) -

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

apt -y install openssh-server

nano /etc/ssh/sshd_config

PermitRootLogin no

systemctl restart ssh ; systemctl status ssh                                 

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Setup FTP  -

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

nano /etc/vsftpd.conf

write_enable=YES

ascii_upload_enable=YES

ascii_download_enable=YES

chroot_local_user=YES

chroot_list_enable=YES

chroot_list_file=/etc/vsftpd.chroot_list

ls_recurse_enable=YES

# add to the end : specify chroot directory

# if not specified, users' home directory equals FTP home directory

local_root=public_html

# turn off seccomp filter if cannot login normally

seccomp_sandbox=NO


nano  /etc/vsftpd.chroot_list

# add users you allow to move over their home directory

ubuntu

systemctl restart vsftpd ; systemctl status vsftpd      


------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Setup Webmin-

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

apt -y install python apt-show-versions libapt-pkg-perl libauthen-pam-perl libio-pty-perl libnet-ssleay-perl

curl -L -O http://www.webmin.com/download/deb/webmin-current.deb

dpkg -i webmin-current.deb


nano /etc/webmin/miniserv.conf

allow=127.0.0.1 192.1.68.1.0/24

systemctl restart webmin


https://www.yourdomain.com:10000/  

______________________________________________________________________________________________________________

Setup LAMP PHPMyAdmin -

______________________________________________________________________________________________________________

apt install apache2 apache2-utils libapache2-mod-php mysql-server mysql-client php-fpm php-cli php-curl php-mysql php-curl php-gd php-mbstring php-pear php-cgi php-imap php-intl php-snmp php-tidy php-zip php-mbstring php-json php-pgsql php-opcache php-mysql php-ldap php-bz2 php-xml phpmyadmin -y


mysql_secure_installation

systemctl enable apache2 php7.4-fpm ; systemctl start apache2 mysql php7.4-fpm

a2enconf php7.4-cgi ; a2enmod rewrite headers


sed -i "s/;date.timezone.*/date.timezone = Asia\/\Kolkata/" /etc/php/*/apache2/php.ini

echo ServerName 127.0.0.1 >> /etc/apache2/apache2.conf


nano /etc/apache2/conf-enabled/security.conf

ServerTokens Prod

nano /etc/apache2/mods-enabled/dir.conf

index.php


nano /etc/apache2/sites-enabled/000-default.conf

<VirtualHost *:80>

    ServerName yourdomain.com

    ServerAlias www.yourdomain.com

    ServerAdmin webmaster@localhost

    DocumentRoot /var/www/html/

    ErrorLog ${APACHE_LOG_DIR}/error.log

    CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>


apachectl configtest ; echo '<?php phpinfo(); ?>' > /var/www/html/info.php ; echo "This is Test Page on www.yourdomain.com" > /var/www/html/index.html ; chown -R $USER:$USER /var/www/html/ ; chmod -R 755 /var/www/html/


mysql -u root -p

create user Test@'localhost' identified by 'StrongPassword';

grant all privileges on *.* to Test@'localhost';

flush privileges;

exit


systemctl restart apache2 php7.4-fpm mysql

http://www.yourdomain.com | http://www.yourdomain.com/info.php  | http://www.yourdomain.com/phpmyadmin/

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

No comments:

Post a Comment