Guide to Install Admin on VPS
This guide will help you install the Investra admin panel on VPS. If you have any questions, please contact our support team. With this tutorial, you can install Investra admin to any type of blank or empty Ubuntu server.
Prerequisites
Before you start, make sure you have the following installed on your VPS:
- Server with PHP version 8.3 or higher
- All extensions are enabled
- Server RAM 4 GB or more recommended
- Server disk 20 GB or more recommended
Installation Process
Step 1: Access VPS
You need to access your VPS. You can use SSH to access your VPS. You can use SSH to access your VPS via PuTTY if you are Windows user or use terminal if you are Linux user.
ssh username@ipaddress
Then enter your password.
Step 2: Install Node.js & Required Applications
- Install Node.js using the package manager for your Linux distribution. For example, on Ubuntu, you can install Node.js using the following command:
sudo apt-get update
sudo apt install curl
curl -sL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo apt update
- Verify that Node.js is installed by running the following command:
node --version
- Install Zip & Unzip
sudo apt-get install zip unzip
Step 3: Setup Server
Nginx is one of the most popular web servers in the world. In this deployment tutorial, we're going to use Nginx to host our website.
Step 3.1: Install Nginx
- Install Nginx using the package manager for your Linux distribution. For example, on Ubuntu, you can install Nginx using the following command:
sudo apt update
sudo apt install nginx
- Verify that Nginx is installed by running the following command:
nginx -v
- Start Nginx by running the following command:
sudo systemctl start nginx
Step 3.2: Add PPA to get the specific PHP version
sudo add-apt-repository ppa:ondrej/php
sudo apt update
Step 3.3: Adjusting the Firewall
Before testing Nginx, the firewall software needs to be adjusted to allow access to the service.
To check the ufw list, use this command:
sudo ufw status
sudo ufw app list
At first, add SSH to the firewall:
sudo ufw allow ssh
sudo ufw allow OpenSSH
After that, to enable Nginx on the firewall, use this command:
sudo ufw allow 'Nginx Full'
Now enable the firewall:
sudo ufw enable
sudo ufw default deny
Step 4: Install MySQL
- Install MySQL using the package manager for your Linux distribution:
sudo apt-get install mysql-server
- Start the MySQL service:
sudo systemctl start mysql
- Verify the installation:
mysql --version
- Secure your MySQL installation:
sudo mysql_secure_installation
- Follow the on-screen instructions to secure your MySQL installation.
Step 5: Install PHP
Install PHP and the required PHP extensions:
sudo apt install php8.3 php8.3-curl php8.3-fileinfo php8.3-gd php8.3-bcmath php8.3-gettext php8.3-mbstring php8.3-bcmath php8.3-exif php8.3-mysqli php8.3-pdo php8.3-zip php8.3-xml -y
Note: If you get any error then use this command:
sudo apt update
sudo apt install -y software-properties-common ca-certificates lsb-release apt-transport-https
Add Ondřej Surý's PHP PPA:
sudo add-apt-repository ppa:ondrej/php -y
sudo apt update
Again install all the required PHP extensions:
sudo apt install -y \
php8.3 php8.3-cli php8.3-common php8.3-mysql php8.3-zip php8.3-gd php8.3-mbstring \
php8.3-curl php8.3-xml php8.3-bcmath php8.3-intl php8.3-readline php8.3-soap
Now Install PHP FPM:
sudo apt install php8.3-fpm -y
Enable PHP FPM:
sudo systemctl enable php8.3-fpm
Step 6: Install Composer
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php
php -r "unlink('composer-setup.php');"
sudo mv composer.phar /usr/bin/composer
Or:
sudo apt-get install composer
Step 7: Create MySQL Database & User
mysql -u root -p
Now, run the following command to create a database and user for Investra:
CREATE DATABASE investra_db;
CREATE USER 'investra_user'@'localhost' IDENTIFIED BY 'investra_password';
GRANT ALL PRIVILEGES ON investra_db.* TO 'investra_user'@'localhost';
FLUSH PRIVILEGES;
exit
Step 8: Change Permission for the www Folder
cd /var/www
sudo chown -R $USER:$USER /var/www
Step 9: Upload the Admin Files
- Create directories for admin on /var/www/:
sudo rm -rf /var/www/investra
sudo mkdir /var/www/investra
sudo mkdir /var/www/investra/admin
- Give permission to the admin directory:
sudo chown -R www-data:www-data /var/www/investra/admin
sudo chmod -R 755 /var/www/investra/admin
- Upload the admin.zip file to the server:
scp -r core/admin.zip root@server:/var/www/investra/admin
- Extract the admin.zip file:
cd /var/www/investra/admin
unzip admin.zip -d /var/www/investra/admin
rm -rf admin.zip
- Give permission to the admin folder:
sudo chown -R www-data:www-data /var/www/investra/admin/bootstrap/cache
sudo chown -R www-data:www-data /var/www/investra/admin/storage
Step 10: Get your Domain Name
We recommend using a subdomain for admin:
app.example.comfor admin panel
Step 11: Setting Up Nginx for Admin
We'll create a new admin configuration file:
sudo touch /etc/nginx/sites-available/investra-admin.conf
sudo nano /etc/nginx/sites-available/investra-admin.conf
Add this Nginx config:
server {
listen 80;
server_name app.YOUR_ADMIN_DOMAIN.com www.YOUR_ADMIN_DOMAIN.com;
root /var/www/investra/admin/public;
index index.php index.html;
charset utf-8;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
}
error_page 404 /index.php;
location ~ /\.(?!well-known).* {
deny all;
}
}
Then enable the config:
sudo ln -s /etc/nginx/sites-available/investra-admin.conf /etc/nginx/sites-enabled/investra-admin.conf
Step 12: Secure Server
sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d YOUR_ADMIN_DOMAIN.com -d www.YOUR_ADMIN_DOMAIN.com
Step 13: Restart Nginx
Make sure you didn't introduce any syntax errors:
sudo nginx -t
Now, restart the Nginx service and PHP-FPM service:
sudo systemctl restart php8.3-fpm
sudo systemctl restart nginx
Step 14: Graphical User Interface (GUI) Installation
-
Now access your domain name on your browser, then you can see the graphical user interface for the installation.
-
Agree with the terms and conditions and click "I Agree, Next Step" button.
-
Now you can see the server requirements. If all the requirements are met then click "Next Step" button.
-
Now check all the required folder permissions is met then click "Next Step" button.
-
You see the configuration page and fill the required information:
- Application URL: http://yourdomain.com
- Application Name: investra
Database Information
- Database Name: Ex: investra_db
- Database Username: ex: investra_user
- Database Password: ex: investra
- Database Host: localhost
Admin Information
- Admin First Name: ex: admin
- Admin Last Name: ex: admin
- Admin Email: ex: admin@gmail.com
- Admin Password: ex: 12345678
-
Now hit "Install" button.
-
Now you will see the installation is completed. You can now access your Investra on your domain name.
Step 15: Queue and Cron Job Setup
Install Supervisor
sudo apt update
sudo apt install supervisor
Create Supervisor Config File
sudo nano /etc/supervisor/conf.d/investra-worker.conf
Add the following content:
[program:investra-worker]
process_name=%(program_name)s_%(process_num)02d
command=/usr/bin/php /var/www/investra/admin/artisan queue:work --sleep=3 --tries=3 --timeout=60
autostart=true
autorestart=true
user=your_linux_user
numprocs=1
redirect_stderr=true
stdout_logfile=/var/www/investra/admin/storage/logs/investra-worker.log
Note: Replace your_linux_user with your Linux user.
Restart Supervisor
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start investra-worker:*
Check the status:
sudo supervisorctl status
Setup Cron Job
Enable the cron tab:
crontab -e
Select your favorite editor, then add the following line at the end of the file:
* * * * * cd /var/www/investra/admin && php artisan schedule:run >> /dev/null 2>&1
Note: Replace /var/www/investra/admin with the path to your project on your VPS.
Verify:
crontab -l
Conclusion
Congratulations! You have successfully installed Investra admin on your VPS. If you have any questions, please contact our support team.