Server-Installation
Prerequisites
- Apache
- MySQL 8.0
- PHP 8.2 with extensions:
- bcmath
- bz2
- intl
- gd
- mbstring
- mysql
- zip
- fpm
- curl
- xml
- phpMyAdmin
- Composer
- Node.js v20.12.2
- npm v10.8.3
- Domain - Specify your domain name (e.g., example.com) for the application to function properly.
- FTP: Used for building and deploying applications.
- Laravel Supervisor: Manages and runs Laravel background jobs efficiently.
1.Introduction
We are strongly prefer any Server with ubuntu OS. Because it is quite easy to setup and maintain.
Minimum Server Requirements
- Any server with UBUNTU Preferred
- 4 GB Ram
- 30 GB Stoarge
- vCPU 2 cores
2.Install Apache
Follow these steps to install and configure Apache:
Steps to Install Apache
- Step 1: Open the SSH terminal for your AWS instance using the PEM file.
- Step 2: Install Apache by running:
"sudo apt install apache2"
- Step 3: Update the package list:
"sudo apt update"
- Step 4: Edit the Apache configuration file:
"sudo nano /etc/apache2/sites-available/000-default.conf"
Apache Configuration
<Directory /var/www/html>
Options -Indexes
AllowOverride All
Require all granted
ErrorDocument 403 "You don't have permission to access this URL"
ErrorDocument 404 "The requested page was not found. Please contact the admin for more details."
</Directory>
- Step 5: Restart the Apache service:
"sudo service apache2 restart"
For more detailed instructions, check out the guide here: How to Install the Apache Web Server on Ubuntu 20.04
3.Install PHP 8.2
Follow the steps below to install PHP 8.2, along with the required extensions:
Required Extensions: bcmath, bz2, intl, gd, mbstring, mysql, zip, fpm, curl, xml
Steps to Install PHP 8.2
- Step 1: Update your package list:
"sudo apt update"
- Step 2: Install necessary software properties:
"sudo apt install software-properties-common"
- Step 3: Add the PHP repository:
"sudo add-apt-repository ppa:ondrej/php"
- Step 4: Update your package list again:
"sudo apt update"
- Step 5: Install PHP 8.2:
"sudo apt install php8.2"
- Step 6: Install the required PHP 8.2 extensions:
"sudo apt-get install php8.2-{bcmath,bz2,intl,gd,mbstring,mysql,zip,fpm,curl,xml} -y"
For detailed instructions, refer to the guide here: How to Install PHP 8.2 on Ubuntu 22.04
4.Install MySQL
Follow these steps to install MySQL:
Steps to Install MySQL
- Step 1: Update the package list:
"sudo apt-get update"
- Step 2: Install MySQL server:
"sudo apt-get install mysql-server"
- Step 3: Secure the MySQL installation:
"mysql_secure_installation"
- Step 4: Restart the MySQL service:
"sudo service mysql restart"
Creating a New MySQL User
To set up a new MySQL user, follow these steps:
- Step 1: Log in to MySQL as the root user:
"sudo mysql -u root"
- Step 2: It Will Switch to the MySQL database For create user.
-
Step 3:Create User:
"CREATE USER 'TaxiUser'@'localhost' IDENTIFIED WITH mysql_native_password BY 'TaxiUser@123';"
-
Step 4: Grant privileges:
"GRANT ALL ON *.* TO 'TaxiUser'@'localhost';"
- Step 5: Apply the changes:
"FLUSH PRIVILEGES;"
For detailed instructions, refer to the guide here: How to Install MySQL on Ubuntu 20.04
5.Install phpMyAdmin
Follow these steps to install phpMyAdmin:
Steps to Install phpMyAdmin
- Step 1: Navigate to the directory:
"cd /var/www/html"
- Step 2: Download the phpMyAdmin package using the following command:
"sudo wget https://files.phpmyadmin.net/phpMyAdmin/5.2.1/phpMyAdmin-5.2.1-all-languages.zip"
- Step 3: Unzip the downloaded package:
"sudo unzip phpMyAdmin-5.2.1-all-languages.zip"
- Step 4: Rename the extracted folder to "pma":
"sudo mv phpMyAdmin-5.2.1-all-languages pma"
- Step 5: Rewrite enmod:
"sudo a2enmod rewrite "
After completing these steps, phpMyAdmin will be ready to use at http://your_server_ip/pma
.
6.Node.js and npm Installation
Follow these steps to install the required versions of Node.js and npm:
-
Step 1: Install Node.js v20.12.2
To install Node.js v20.12.2, use the Node Version Manager (nvm). If you don't have nvm installed, install it first by using the following command:
"curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash"
After installing nvm, close and reopen the terminal, then proceed to install Node.js:
"nvm install 20.12.2"
Set Node.js v20.12.2 as the default version:
"nvm use 20.12.2"
-
Step 2: Install npm v10.8.3
After installing Node.js, install the specific npm version using the following command:
"npm install -g npm@10.8.3"
-
Step 3: Verify the installation
Check the installation of Node.js and npm to ensure they are correctly installed:
"node -v"
Verify the npm version:
"npm -v"
Reference Links
For further information, please visit the following links:
7.Install Composer
Follow these steps to install Composer:
-
Step 1: Navigate to the home directory
Start by navigating to the home directory:
"cd ~"
-
Step 2: Download the Composer installer
Use the following command to download the Composer installer script:
"curl -sS https://getcomposer.org/installer -o /tmp/composer-setup.php"
-
Step 3: Verify the installer signature
First, get the expected hash for the installer:
"HASH=`curl -sS https://composer.github.io/installer.sig`"
Then, display the hash value:
"echo $HASH"
-
Step 4: Validate the installer
Check if the downloaded installer matches the hash:
"php -r "if (hash_file('SHA384', '/tmp/composer-setup.php') === '$HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;""
-
Step 5: Install Composer
If the installer is verified, proceed with the installation:
"sudo php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer"
-
Step 6: Verify the installation
Run the following command to check that Composer is installed correctly:
"composer"
Alternatively, you can follow the instructions from the reference link below:
Reference Link: How to Install and Use Composer on Ubuntu 20.04 - DigitalOcean
8.Install FTP
Follow these instructions to install FTP on an Ubuntu server:
-
Install vsftpd:
"sudo apt install vsftpd"
-
Backup the vsftpd configuration file:
"sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.bak"
-
Edit the vsftpd configuration file:
"sudo nano /etc/vsftpd.conf"
. Add the following lines to the end of the file:listen=NO listen_ipv6=YES anonymous_enable=NO local_enable=YES dirmessage_enable=YES write_enable=YES chroot_local_user=YES pasv_min_port=12000 pasv_max_port=12100 ssl_enable=NO port_enable=YES allow_writeable_chroot=YES
-
Restart the vsftpd service:
"sudo systemctl restart vsftpd"
-
Create an FTP user:
"sudo adduser ftp_user"
-
Assign the user's home directory:
"sudo usermod -d /var/www/html ftp_user"
-
Add the user to the www-data group:
"sudo usermod -aG www-data ftp_user"
-
Change ownership of the directory: Navigate to /var/www and then run:
"sudo chown -R ftp_user:www-data html/"
-
Update directory permissions:
"sudo chmod -R 775 html/"