LAMP

This is a VERY Dirty Setup, by dirty I mean there is not much for descriptions on what you are doing vs. just typing in the code.

Objective:

  1. L-Ubuntu Server Install
  2. A-Apache Install and Firewall Rules
  3. M-MySQL Install (MariaDB?)
  4. P-php Install (php7.4)
  5. U-unzip Install
  6. Apache Setup & Configuration
  7. Create Basic Landing Page
  8. SSL – Certbot Install and SSL Configuration
  9. Webmin Installation
  10. xRDP and Desktop Setup 
  11. Xoops Install and Setup
  12. webERP, DokuWiki (Integrated) and webSHOP Install and Setup
  13. ERPNext, LMS, Onboarding System, SSO system, POS/Restaurant POS are on the agenda. Stay Tuned.
NOTE, instructions below are in preparation to install ERPNext, however, there is no documentation on its installation in this document.

L of Lamp Install (Linux)

Install Linux (Ubuntu 22.04). Follow Hosted VPS Install (I had to basically reinstall an image of Ubuntu_22.04, if you are doing a fresh install of Ubuntu, do a google search, get Ubuntu installed and come back.)

Side Note: After all the configuration is done, if you make any changes to the files or structure to /var/www/flexpaul_net you should re-run this command:

$ sudo chown -R $USER:$USER /var/www/flexpaul_net

Setup USER (if fresh install via VPS image)

$ adduser USERNAME
$ usermod -aG sudo USERNAME

Check

$ groups USERNAME
$ exit

Log back in as new user

If your working with multiple servers, you may want to change your host name to something you know.

$ sudo nano /etc/hostname

Change Ubuntu to your server’s friendly name and save.

flxplnet

Exit and reconnect to see your changes.

Update & Upgrade the system

$ sudo apt update && sudo apt upgrade
$ sudo reboot now

A of LAMP Install (Apache)

$ sudo apt install apache2
$ sudo ufw app list

*Since we are installing SSL very soon…

$ sudo ufw allow in "Apache Full"
$ sudo ufw allow in "OpenSSH"
$ sudo ufw status

(will be disabled since we are using an external firewall)

To open all the ports we will need going forward, on your firewall, Open Ports 80; 443; 10000 to your server

M of LAMP Install (MariaDB)

MariaDB is in testing mode – I haven’t really tried it yet. You can install MariaDB or MySQL, Skip to the next M for MySQL. However, with most of my tests, MariaDB is working better then MySQL. Since MariaDB is a MySQL “DropInReplacement” we will continue to use MySQL commands.
$ sudo apt update
$ sudo apt install mariadb-server
$ sudo mysql_secure_installation

Should be 2 no’s and the rest yes.

(Enter), 

n (Enter), 

[Set root Password] = N (enter)

Create an admin user for MariaDB, replace password with your password. Side note, I am not sure if we really need to do this step, I know in MySQL we didn’t need to, however, MariaDB does work a little differently.
$ sudo mysql
$ mysql> GRANT ALL ON *.* TO 'admin'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
$ mysql> FLUSH PRIVILEGES;
$ mysql> exit
$ sudo systemctl status mysql
$ sudo mysqladmin version
Control+C if you get stuck in status or version

M of LAMP Install (MySQL)

ONLY IF YOU DID NOT INSTALL MariaDB

$ sudo apt install mysql-server
$ sudo mysql_secure_installation

** NO for the first option, and Y for the rest **

Check

$ sudo mysql
$ mysql> exit 

P of LAMP Install (php7)

(software-properties-common may already be installed)

$ sudo apt install software-properties-common

$ sudo add-apt-repository ppa:ondrej/php

$ sudo apt update

$ sudo apt install php7.4-{cli,common,curl,zip,gd,mysql,xml,mbstring,json,intl,fpm} php-perl libapache2-mod-php7.4

$ php -v

Should say 7.4

unZip Install (Simple)

$ sudo apt install unzip

Apache Setup & Configuration:

There are some notes to read about DokuWiki configuration that you may want to decide now. If you move on without deciding you can come back later after you get that far and edit your wiki_ sites available file.

$ cd ~
$ sudo mkdir /var/www/flexpaul_net
$ sudo chown -R $USER:$USER /var/www/flexpaul_net

Create the following files:
At the time of writing I have not setup ERPNext yet, however there is code to add it in the future.

$ sudo nano /etc/apache2/sites-available/flexpaul_net.conf

<VirtualHost *:80>
    ServerName flexpaul.net
         ServerAdmin webmaster@localhost
    DocumentRoot /var/www/flexpaul_net
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
$ sudo nano /etc/apache2/sites-available/xps_.conf

<VirtualHost *:80>
    ServerName xps.flexpaul.net
    ServerAlias www.flexpaul.net 
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/flexpaul_net/xps_
         <Directory /var/www/flexpaul_net/xps_/>
               Options FollowSymlinks
               AllowOverride All
               Require all granted
          </Directory>
     ErrorLog ${APACHE_LOG_DIR}/xps-error.log
     CustomLog ${APACHE_LOG_DIR}/xps-access.log combined
</VirtualHost>
 $ sudo nano /etc/apache2/sites-available/webERP_.conf

<VirtualHost *:80>
    ServerName erp.flexpaul.net
     ServerAdmin webmaster@localhost
    DocumentRoot /var/www/flexpaul_net/webERP_
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
 $ sudo nano /etc/apache2/sites-available/webSHOP_.conf

<VirtualHost *:80>
    ServerName shop.flexpaul.net
     ServerAdmin webmaster@localhost
    DocumentRoot /var/www/flexpaul_net/webSHOP_
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
 $ sudo nano /etc/apache2/sites-available/wiki_.conf

<VirtualHost *:80>
  ServerAdmin admin@your-domain.com
  DocumentRoot /var/www/flexpaul_net/webERP_/wiki_
  ServerName wiki.flexpaul.net 
  ErrorLog ${APACHE_LOG_DIR}/error.log 
  CustomLog ${APACHE_LOG_DIR}/access.log combined
    <Directory /var/www/flexpaul_net/webERP/wiki_/(bin/|conf/|data/|inc/)/>
        Options FollowSymlinks
        AllowOverride All
        Require all granted 
    </Directory>
</VirtualHost>
 $ sudo nano /etc/apache2/sites-available/nxt_.conf

<VirtualHost *:80>
    ServerName nxt.flexpaul.net
     ServerAdmin webmaster@localhost
    DocumentRoot /var/www/flexpaul_net/ERPnext_
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
$ sudo a2ensite flexpaul_net
$ sudo a2ensite xps_
$ sudo a2ensite webERP_
$ sudo a2ensite webSHOP_
$ sudo a2ensite wiki_
$ sudo a2ensite nxt_
$ sudo a2dssite 000-default
$ sudo apache2ctl configtest

We do get errors since our future directories do not exist.

$ sudo systemctl reload apache2

Create Basic Landing Page (Optional)

$ cd ~
$ sudo nano /var/www/flexpaul_net/index.html

Enter the following

<html>
   <head>
      <title>FLEXPAUL website</title>
   </head>
   <body>
      <h1>Whatz Up Hommies</h1>
      <p>This is the Server-System of <strong>flexpaul.net</strong>.</p>
      <p>All software is tested and ran from this server.</p>
      <p>Unauthorized access is prohibited</p>
      <h2>This site is HIGHLY UNDER CONSTRUCTION!</h2>
  </body>
</html>

That will give flexpaul.net a landing page, since www will be re-directed to xps.

NEXT STEP

SSL – Certbot Install and SSL Config.

$ sudo apt install certbot python3-certbot-apache
$ sudo certbot --apache

Email: yourawesomeemailaddress@here.com

Answers:

Y,  N,  (ENTER), 

CHECK Timer is running for your cert.

$ sudo systemctl status certbot.timer
$ sudo certbot renew --dry-run

END CHECK AND STEP

Webmin Install

$ cd ~
$ sudo nano /etc/apt/sources.list.d/webmin.list

Add the following line

deb http://download.webmin.com/download/repository sarge contrib
$ wget http://www.webmin.com/jcameron-key.asc

Import it with:

$ sudo apt-key add jcameron-key.asc
$ sudo apt update
$ sudo apt install webmin

CHECK

$ systemctl status webmin

Set firewall External/Internal to open TCP port 10000.

$ sudo ufw allow 10000/tcp

https://your-server-ip:10000

Setting Up Reverse Proxy

Not tried, going to thou, hell ya!
https://www.linuxbabe.com/ubuntu/install-webmin-ubuntu-16-04-server

Remote Desktop Install

$ cd ~
$ sudo apt update
$ sudo apt install xfce4

gdm3 – appears to be the default, however I would like to try lightdm.

Disable GUI on HOST on reboot. Really should do this in headless mode. (VPS)

$ sudo systemctl set-default multi-user.target
$ sudo apt install xrdp -y
$ sudo usermod -a -G ssl-cert xrdp
$ sudo systemctl restart xrdp
$ echo "xfce4-session" | tee .xsession
$ sudo systemctl restart xrdp

CMS / xoops install

Lightwight CMS system (Xoops, Admidio)

Setup Database:
database: myxpsdb
User: myxpsdbuseruser
password: WebUser!642@fun 

Location will be /var/www/flexpaul_net/xps_

$ sudo mysql
$ mysql> CREATE USER 'myxpsdbuseruser'@'localhost' IDENTIFIED BY 'WebUser!642@fun';
$ mysql> CREATE DATABASE myxpsdb;
$ mysql> GRANT ALL PRIVILEGES ON myxpsdb.* TO 'myxpsdbuseruser'@'localhost';

NOT REQURIED IF YOU KNOW YOUR character set

>This is to assist with installing xoops, please make note of your character set.

$ mysql> USE xpsflxpl; SELECT @@character_set_database, @@collation_database;

>+—————————–+————————+
| @@character_set_database | @@collation_database |
+—————————–+————————+
| utf8mb4                                    | utf8mb4_0900_ai_ci     |
+—————————–+————————+

>$ mysql> exit

Download and Install XOOPS CMS.

$ cd /tmp
$ sudo wget https://github.com/XOOPS/XoopsCore25/archive/refs/tags/v2.5.10.tar.gz
$ sudo tar –xvzf v2.5.10.tar.gz
$ sudo cp -r /tmp/XoopsCore25-2.5.10/htdocs /var/www/flexpaul_net/xps_

Permissions.

$ sudo chown -R www-data:www-data /var/www/flexpaul_net/xps_
$ sudo chmod -R 755 /var/www/flexpaul_net/xps_
$ sudo a2enmod rewrite
$ sudo apache2ctl configtest

Note we are down to one site error!

$ sudo systemctl restart apache2

Next, open your browser, go to the URL., and continue with the installation.

http://xps.YourDomain.net/install

You should see the XOOPS installation page. Select your language and start the installation.

YOU MUST FINISH THE ONLINE INSTALLER Then come back and finish up.

FINAL STEPS

$ sudo mkdir /var/www/.xps_private
$ sudo mv /var/www/flexpaul_net/xps_/xoops_data /var/www/.xps_private/xoops_data
$ sudo mv /var/www/flexpaul_net/xps_/xoops_lib /var/www/.xps_private/xoops_lib
$ sudo nano /var/www/flexpaul_net/xps_/mainfile.php

EDIT the lines for 

// For forward compatibility
// Physical path to the XOOPS library directory WITHOUT trailing slash
define('XOOPS_PATH', '/var/www/.xps_private/xoops_lib');
// Physical path to the XOOPS datafiles (writable) directory WITHOUT trailing slash
define('XOOPS_VAR_PATH', '/var/www/.xps_private/xoops_data');

xoops_lib >>to>> .xps_private/xoops_lib
xoops_data >>to>> .xps_private/xoops_lib

CMS Installed, Please continue past the Security configuration as I have not completed it – Going to Look into the following, if you know whats going on then don’t skip it:

Security configuration

The installer will try to configure your site for security considerations. Please double check to make sure:

The mainfile.php is readonly.
Remove the folder install_remove_17847635666559509b75658 (or install if it was not renamed automatically by the installer) from your server

webERP, DokuWiki, and webSHOP Install

I desided to roll all three of these into one, and technically it is only 2 separate programs, I am treating webSHOP as it’s own. (And after I did, I should have left them as two, we will see, certain permissions where required and that is why I rolled them into one step.)

DB Information:
WebERP DB: weberpdb
WebERP DB User: weberpdbuser
Passwords: WebUser!642@fun

$ cd /tmp
$ sudo wget https://sourceforge.net/projects/web-erp/files/webERP_4.15.2.zip
$ wget https://github.com/PhilDaintree/webSHOP/archive/refs/heads/master.zip
$ sudo wget https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz
$ sudo unzip webERP*
$ sudo unzip master.zip
$ sudo mkdir wiki_
$ sudo tar xzf dokuwiki-stable.tgz -C wiki_ --strip-components=1
$ sudo cp -r /tmp/webERP /var/www/flexpaul_net/webERP_
$ sudo cp -r /tmp/webSHOP-master /var/www/flexpaul_net/webSHOP_

To Integrate Dokuwiki into webERP:

$ sudo cp -r /tmp/wiki_ /var/www/flexpaul_net/webERP_/wiki_

For Wiki to be outside of webERP folder (breaks fuctionallity with webERP):

$ sudo cp -r /tmp/wiki_ /var/www/flexpaul_net/wiki_

Side Note about WIKI locations. If you are installing the wiki to work with webERP, install via the integrated way, you can adjust your sites-available file to point to /webERP_/wiki_ instead of /wiki_. Otherwise you can install outside of the /webERP_ folder, but that will break functionallity between the two.

$ sudo groupadd web-grp
$ sudo gpasswd -a www-data web-grp
$ sudo chown -R :web-grp /var/www/flexpaul_net/webERP_
$ sudo chown -R :web-grp /var/www/flexpaul_net/webSHOP_
$ sudo chmod -R ug+rw /var/www/flexpaul_net/webERP_
$ sudo chmod -R ug+rw /var/www/flexpaul_net/webSHOP_
$ sudo find /var/www/flexpaul_net/webERP_ -type d -exec chmod g+xs {} \;
$ sudo find /var/www/flexpaul_net/webSHOP_ -type d -exec chmod g+xs {} \;

If you are installing DokuWiki outside of /webERP_ then include the commands on the /wiki_ folder.

$ sudo chown -R :web-grp /var/www/flexpaul_net/wiki_
$ sudo chmod -R ug+rw /var/www/flexpaul_net/wiki_
$ sudo find /var/www/flexpaul_net/wiki_ -type d -exec chmod g+xs {} \;

Going forward you will need to set your ftp program’s umask to 002. 

$ sudo service apache2 restart
$ sudo mysql
$ mysql> CREATE DATABASE weberpdb;
$ mysql> CREATE USER ‘weberpdbuser’@’localhost’ IDENTIFIED BY ‘WebUser!642@fun’;
$ mysql> GRANT ALL PRIVILEGES ON weberpdb.* TO ‘weberpdbuser’@’localhost’;
$ mysql> FLUSH PRIVILEGES;
$ mysql> EXIT

Open a Web Browser and navigate to

erp.yourwebsite.com

and you should be redirected to an Install Page, finish the install using the information we used above, after that is completed, navigate to

wiki.yourwebsite.com/install.php

OR erp.yourwebsite.com/wiki_/install.php

you should be redirected to an Install Page, follow the on screen instructions using the information outlined above.

AFTER ALL THAT

$ sudo reboot now

Reboot your server and refill your coffee, have a donut, grab a smoke, beer, whatever!!