Sunday, September 27, 2020

How To Run Jenkins on Docker container On Ubuntu 20.04

 Video Tutorial -

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

Jenkins is an open source automation tool written in Java with plugins built for Continuous Integration purpose.
Offcial Website -https://www.jenkins.io/

Docker is an open source platform for building, deploying, and managing containerized applications.
Docker website - https://www.docker.com/
Docker container is a virtualized run-time environment where users can isolate applications from the underlying system.
jenkins Dockerhub Link -https://hub.docker.com/_/jenkins/
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Testing Environment: Ubuntu 20.04 LTS        Hostname - www.yourdomain.com         ip Address - 192.168.1.10
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
apt update ; apt install -y build-essential net-tools curl git software-properties-common neofetch apt-transport-https ca-certificates curl gnupg-agent docker.io docker-compose
systemctl enable --now docker ; usermod -aG docker $USER ; newgrp docker

docker pull jenkins/jenkins
docker run -p 8080:8080 --name=jenkins-master jenkins/jenkins
http://192.168.1.10:8080

Container-id -docker ps -aq                         
Stop Container - docker stop Container-id               
Start Container - docker start Container-id
Check Container logs- docker logs Container-id
Delete a Docker Image -docker rmi Container-id

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

Thursday, September 24, 2020

How To install Papoo CMS On Ubuntu 18.04

Video Tutorial - 

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

 Papoo CMS is a multi-lingual open source content management system with additional functions and SEO features.
Offcial Website: https://www.papoo.de/free-cms-kostenloser-download.html
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Our Server Specification-     
Os:Ubuntu 18.04 LTS Bionic Beaver 64Bit   | IP address- 192.168.1.50 | Hostname :www.yourdomain.com
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
lsb_release -cd ; hostname ; hostname -I ; whoami ; getconf LONG_BIT ; apt install -y build-essential software-properties-common curl gdebi net-tools wget sqlite3 dirmngr nano lsb-release apt-transport-https git leafpad git

MariaDB Repositories:
apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8 ; add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://mirror.biznetgio.com/mariadb/repo/10.4/ubuntu bionic main'

Nginx Mariadb Php PHP Modules :
add-apt-repository ppa:ondrej/php -y
apt-get update ; apt install -y nginx mariadb-server mariadb-client php7.2 php7.2-cli php7.2-fpm php7.2-cgi php7.2-bcmath php7.2-curl php7.2-gd php7.2-intl php7.2-json php7.2-mbstring php7.2-mysql php7.2-opcache php7.2-sqlite3 php7.2-xml php7.2-zip php7.2-snmp php7.2-json php7.2-imap php7.2-common php7.2-tidy php7.2-pgsql php7.2-ldap php-imagick php-pear

systemctl start nginx mariadb ; systemctl enable nginx mariadb ; mysql_secure_installation

Create Mariadb Database :
mysql -u root -p
create database db;
grant all on db.* to 'dbuser'@'localhost' identified by 'dbpass';
flush privileges;
quit

sed -i "s/;date.timezone.*/date.timezone = Asia\/\Kolkata/" /etc/php/7.2/fpm/php.ini ; sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php/7.2/fpm/php.ini
leafpad  /etc/php/7.2/fpm/pool.d/www.conf &>/dev/null  env[HOSTNAME] = $HOSTNAME ]

cd /tmp ; wget https://www.papoo.de/dokumente/upload/5bd66_papoo-light-v1811.zip
mkdir /var/www/html/papoo
unzip 5bd66_papoo-light-v1811.zip -d /var/www/html/papoo
chown -R www-data:www-data /var/www/html/papoo/ ; chmod -R 755 /var/www/html/papoo/

Setting up Nginx Server Blocks (Virtual Hosts):-
leafpad /etc/nginx/sites-available/default &>/dev/null
server {
    server_name www.yourdomain.com;

    access_log /var/log/nginx/yourdomain-access.log;
    error_log /var/log/nginx/yourdomain-error.log;
    root /var/www/html/papoo/;

    location / {
        index index.php;
        try_files $uri $uri/ /index.php$is_args$args;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.2-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
}

nginx -t  ; echo "192.168.1.50 www.yourdomain.com" >> /etc/hosts ; systemctl restart nginx mariadb
http://www.yourdomain.com
rm -rf /var/www/html/papoo/setup ; chmod 444 /var/www/html/papoo/lib/site_conf.php
http://www.yourdomain.com/interna/
Username: root

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

Sunday, September 20, 2020

How To Install MediaWiki On Ubuntu 18.04 With Nginx MariaDB And PHP

Video Tutorial -

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

 Mediawiki is a free and open source wiki software that allows you to create your own wiki site. It is written in PHP and uses MySQL/MariaDB database backend. Mediawiki comes with lots of features including, Multilanguage support, User Management, Content management and sharing, Editing, Formatting, Referencing and much more.
Offcial Website:https://www.mediawiki.org/wiki/MediaWiki
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Our Server Specification-     
Os:Ubuntu 18.04 LTS Bionic Beaver 64Bit   |            IP address- 192.168.1.50                 | Hostname :www.yourdomain.com
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
lsb_release -cd  ; getconf LONG_BIT ; whoami ; hostname -f ; hostname -I ; apt update ;  apt install -y build-essential software-properties-common curl gdebi wget aptitude nano git net-tools lsb-release apt-transport-https

apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://mirror.biznetgio.com/mariadb/repo/10.4/ubuntu bionic main'
add-apt-repository ppa:ondrej/php -y
apt-get update ; apt-get install -y nginx mariadb-server mariadb-client  php7.3 php7.3-cli php7.3-fpm php7.3-cgi php7.3-bcmath php7.3-curl php7.3-gd php7.3-intl php7.3-json php7.3-mbstring php7.3-mysql php7.3-opcache php7.3-sqlite3 php7.3-xml php7.3-zip php7.3-snmp php7.3-json php7.3-imap php7.3-common php7.3-tidy

systemctl start nginx mariadb ; systemctl enable nginx mariadb
mysql_secure_installation

mysql -u root -p
create database db;
grant all on db.* to 'dbuser'@'localhost' identified by 'dbpass';
quit

gedit /etc/php/7.3/fpm/php.ini &>/dev/null                                                [ date.timezone ="Asia/Kolkata" cgi.fix_pathinfo=0 ]
gedit /etc/php/7.3/fpm/pool.d/www.conf &>/dev/null                          [ env[HOSTNAME] = $HOSTNAME ]


wget https://releases.wikimedia.org/mediawiki/1.33/mediawiki-1.33.0.tar.gz
tar -xvzf  mediawiki-1.33.0.tar.gz
cp -r mediawiki-1.33.0 /var/www/html/mediawiki
chown -R www-data:www-data /var/www/html/ ; chmod -R 755 /var/www/html/

gedit /etc/nginx/sites-available/default &>/dev/null
server {
    server_name www.yourdomain.com;

    access_log /var/log/nginx/yourdomain-access.log;
    error_log /var/log/nginx/yourdomain-error.log;
    root /var/www/html/mediawiki/;

    location / {
        index index.php;
        try_files $uri $uri/ /index.php$is_args$args;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.3-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
}
nginx -t  ; echo "192.168.1.50 www.yourdomain.com" >> /etc/hosts ; systemctl restart php7.3-fpm nginx mariadb
http://www.yourdomain.com
cp -r /home/ubuntu/Downloads/LocalSettings.php /var/www/html/mediawiki/
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

How To Install MediaWiki On Ubuntu 18.04 With Apache2 MariaDB And PHP

 Video Tutorial -

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

 Mediawiki is a free and open source wiki software that allows you to create your own wiki site. It is written in PHP and uses MySQL/MariaDB database backend. Mediawiki comes with lots of features including, Multilanguage support, User Management, Content management and sharing, Editing, Formatting, Referencing and much more.
Offcial Website:https://www.mediawiki.org/wiki/MediaWiki
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Our Server Specification-     
Os:Ubuntu 18.04 LTS Bionic Beaver 64Bit   |            IP address- 192.168.1.50                 | Hostname :www.yourdomain.com
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
lsb_release -cd  ; getconf LONG_BIT ; whoami ; hostname -f ; hostname -I ; apt-get update ; apt install -y build-essential software-properties-common curl wget nano git net-tools lsb-release apt-transport-https

apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://mirror.biznetgio.com/mariadb/repo/10.4/ubuntu bionic main'
add-apt-repository ppa:ondrej/php -y
apt-get update ; apt install  -y apache2 mariadb-server mariadb-client  php7.3 libapache2-mod-php7.3 php7.3-cli php7.3-fpm php7.3-cgi php7.3-bcmath php7.3-curl php7.3-gd php7.3-intl php7.3-json php7.3-mbstring php7.3-mysql php7.3-opcache php7.3-sqlite3 php7.3-xml php7.3-zip php7.3-snmp  php7.3-imap php7.3-common php7.3-tidy

a2enmod dir env headers mime rewrite setenvif
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/7.3/cli/php.ini

systemctl start apache2 mariadb ; systemctl enable apache2 mariadb
mysql_secure_installation

mysql -u root -p
create database db;
grant all on db.* to 'dbuser'@'localhost' identified by 'dbpass';
quit

wget https://releases.wikimedia.org/mediawiki/1.33/mediawiki-1.33.0.tar.gz
tar -xvzf  mediawiki-1.33.0.tar.gz
cp -r mediawiki-1.33.0 /var/www/html/mediawiki
chown -R www-data:www-data /var/www/html/ ; chmod -R 755 /var/www/html/

Apache VirtualHost :
gedit /etc/apache2/sites-available/yourdomain.conf &>/dev/null
<VirtualHost *:80>
     ServerAdmin admin@yourdomain.com
     DocumentRoot /var/www/html/mediawiki
     ServerName www.yourdomain.com

     <Directory /var/www/html/mediawiki/>
          Options FollowSymlinks
          AllowOverride All
          Require all granted
     </Directory>

     ErrorLog ${APACHE_LOG_DIR}/yourdomain_error.log
     CustomLog ${APACHE_LOG_DIR}/yourdomain_access.log combined

</VirtualHost>

echo ServerName 127.0.0.1 >> /etc/apache2/apache2.conf
a2ensite yourdomain ; a2dissite 000-default.conf  ; apache2ctl configtest

echo "192.168.1.50 www.yourdomain.com" >> /etc/hosts ; systemctl reload apache2
http://www.yourdomain.com

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

Tuesday, September 15, 2020

How To Install LocomotiveCMS on Ubuntu 18.04

 Video Tutorial -

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

Locomotive is an open source platform to create, publish and edit sites (CMS).
Features:
Multi-sites natively supported
Uses Liquid, a simple and clean templating language
Easy to add custom sections, content types, no SQL needed
Beautiful and intuitive editing interface
Can fully localize all the content and pages
Embed a Restful API to manage every site
Develop and preview sites locally with your favorite tools (Wagon)
Support for Webpack, SASS, HAML and Coffee Script (Wagon)
Offcial Website: https://www.locomotivecms.com/
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Our Server Specification-     
Os:Ubuntu 18.04 LTS Bionic Beaver 64Bit   | IP address- 192.168.1.50  | Hostname :www.yourdomain.com
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
lsb_release -cd ; hostname ; hostname -I ; whoami ; getconf LONG_BIT ; apt update ; apt install -y build-essential software-properties-common git curl gdebi net-tools wget sqlite3 dirmngr nano lsb-release apt-transport-https -y

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

apt-get update ; apt-get install nodejs yarn zlib1g-dev build-essential libpq-dev libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev libffi-dev -y

cd ~/ ; git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL

git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL

rbenv install 2.5.3
rbenv global 2.5.3
gem install bundler
gem install rails -v 5.2.3
rbenv rehash

gem install locomotivecms_wagon
wagon version
mkdir -p ~/example.com
cd ~/example.com
wagon init example.com -t bootstrap
cd example.com
bundle install
bundle exec wagon serve
http://192.168.1.50:3333

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

How To install Lavalite CMS on Ubuntu 18.04

Video Tutorial - 

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

Lavalite is an Open Source Content Management and Application development platform powered by Laravel. It ships with all basic packages like File manager, Themes, Packages, Users, Menus, Roles, Saas etc, to help you in finishing large projects in less time.
Lavalite:This is an open source of Content Management System developed with Laravel framework.
Offcial Website: https://lavalite.org/
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Our Server Specification-     
Os:Ubuntu 18.04 LTS Bionic Beaver 64Bit   |IP address- 192.168.1.50  | Hostname :www.yourdomain.com
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
lsb_release -cd ; hostname ; hostname -I ; whoami ; getconf LONG_BIT ; apt install -y build-essential software-properties-common curl gdebi net-tools wget curl sqlite3 dirmngr nano lsb-release apt-transport-https leafpad git sudo unzip socat bash-completion

MariaDB Repositories & Php PPA:
apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8 ; add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://mirror.biznetgio.com/mariadb/repo/10.4/ubuntu bionic main' && add-apt-repository ppa:ondrej/php -y

apt-get update ; apt install -y apache2 mariadb-server mariadb-client php7.2 libapache2-mod-php7.2 php7.2-cli php7.2-fpm php7.2-cgi php7.2-bcmath php7.2-curl php7.2-gd php7.2-intl php7.2-json php7.2-mbstring php7.2-mysql php7.2-opcache php7.2-sqlite3 php7.2-xml php7.2-zip php7.2-snmp php7.2-json php7.2-imap php7.2-common php7.2-tidy php7.2-pgsql php7.2-ldap php7.2-soap php7.2-snmp php7.2-xsl  php7.2-recode php-imagick php-pear php-memcache php-apcu

a2enmod dir env headers mime rewrite setenvif ; sed -i "s/;date.timezone.*/date.timezone = Asia\/\Kolkata/" /etc/php/*/apache2/php.ini ; echo ServerName 127.0.0.1 >> /etc/apache2/apache2.conf ; systemctl start apache2 mariadb ; systemctl enable apache2 mariadb ; mysql_secure_installation

Create Mariadb Database :
mysql -u root -p
create database db;
grant all on db.* to 'dbuser'@'localhost' identified by 'dbpass';
flush privileges;
quit

curl -sS https://getcomposer.org/installer | php ; mv composer.phar /usr/local/bin/composer ; chmod +x /usr/local/bin/composer
cd /var/www/html ; composer create-project LavaLite/cms --prefer-dist lavalite
cd /var/www/html/lavalite ;  php artisan lavalite:install
php artisan key:generate
chown -R www-data:www-data /var/www/html/ ; chmod -R 755 /var/www/html/

Apache VirtualHost :
leafpad /etc/apache2/sites-available/yourdomain.conf &>/dev/null
<VirtualHost *:80>

     ServerAdmin admin@yourdomain.com
     DocumentRoot /var/www/html/lavalite/public
     ServerName www.yourdomain.com

     <Directory /var/www/html/lavalite/public/>
          Options FollowSymlinks
          AllowOverride All
          Require all granted
     </Directory>

     ErrorLog ${APACHE_LOG_DIR}/yourdomain_error.log
     CustomLog ${APACHE_LOG_DIR}/yourdomain_access.log combined

</VirtualHost>

a2ensite yourdomain ; a2dissite 000-default.conf  ; apache2ctl configtest ; echo "192.168.1.50 www.yourdomain.com" >> /etc/hosts ; systemctl reload apache2
http://www.yourdomain.com/admin

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

Friday, September 11, 2020

How To Install Mailtrain Newsletter App with Nginx Web Server On Ubuntu 18.04 LTS

Video Tutorial -  https://youtu.be/EhaBZGV5JxM

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

 Mailtrain is an open source, self-hosted newsletter application built from Node.js. Mailtrain is built on top of Nodemailer and it supports MySQL/MariaDB database backends.
Mailtrain is an alternative to commercial email marketing services such as Mailchimp, Sendgrid e.t.c.
Offcial Website: https://mailtrain.org/
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Our Server Specification-     
Os:Ubuntu 18.04 LTS Bionic Beaver 64Bit   | IP address- 192.168.1.50  | Hostname :www.yourdomain.com
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
lsb_release -cd ; hostname ; hostname -I ; whoami ; getconf LONG_BIT ; apt update ; apt install -y build-essential software-properties-common git curl gdebi net-tools wget sqlite3 dirmngr nano lsb-release apt-transport-https -y

apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8 ; add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://mirror.biznetgio.com/mariadb/repo/10.4/ubuntu bionic main'
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
apt-get update ; apt-get install nodejs yarn zlib1g-dev build-essential libpq-dev libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev libffi-dev mariadb-server mariadb-client -y

systemctl start nginx mariadb ; systemctl enable nginx mariadb ; mysql_secure_installation

mysql -u root -p
create database db;
grant all on db.* to 'dbuser'@'localhost' identified by 'dbpass';
flush privileges;
quit

cd ~/ ; wget https://github.com/Mailtrain-org/mailtrain/archive/master.zip
unzip master.zip ; mv mailtrain-master mailtrain
cp ~/mailtrain/config/default.toml ~/mailtrain/config/production.toml
nano ~/mailtrain/config/production.toml
cd ~/mailtrain ; npm install --production


nano /etc/systemd/system/mailtrain.service
[Unit]
Description=Mailtrain Server
Requires=mariadb.service
After=syslog.target network.target

[Service]
Environment="NODE_ENV=production"
WorkingDirectory=/root/mailtrain
ExecStart=/usr/bin/node index.js
Type=simple
Restart=always
RestartSec=10
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=mailtrain

[Install]
WantedBy=multi-user.target

systemctl daemon-reload ; systemctl enable mailtrain ; systemctl start mailtrain ; systemctl status mailtrain

apt install nginx -y
nano /etc/nginx/conf.d/yourdomain.conf
server {
    listen [::]:80;
    listen 80;
    server_name www.yourdomain.com;

    location / {
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_pass http://127.0.0.1:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_next_upstream error timeout http_502 http_503 http_504;
    }
}
rm /etc/nginx/sites-enabled/default
nginx -t  ; echo "192.168.1.50 www.yourdomain.com" >> /etc/hosts ; systemctl restart nginx  
http://www.yourdomain.com
Username: admin | Password: test

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

How To Install Mailtrain Newsletter App with Apache Web Server On Ubuntu 18.04 LTS

Video Tutorial - https://youtu.be/kBMUHqlraLI

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

 Mailtrain is an open source, self-hosted newsletter application built from Node.js. Mailtrain is built on top of Nodemailer and it supports MySQL/MariaDB database backends.
Mailtrain is an alternative to commercial email marketing services such as Mailchimp, Sendgrid e.t.c.
Offcial Website: https://mailtrain.org/
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Our Server Specification-     
Os:Ubuntu 18.04 LTS Bionic Beaver 64Bit   | IP address- 192.168.1.50  | Hostname :www.yourdomain.com
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
lsb_release -cd ; hostname ; hostname -I ; whoami ; getconf LONG_BIT ; apt update ; apt install -y build-essential software-properties-common git curl gdebi net-tools wget sqlite3 dirmngr nano lsb-release apt-transport-https -y

apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8 ; add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://mirror.biznetgio.com/mariadb/repo/10.4/ubuntu bionic main'
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
apt-get update ; apt-get install nodejs yarn zlib1g-dev build-essential libpq-dev libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev libffi-dev mariadb-server mariadb-client apache2 -y

systemctl start apache2 mariadb ; systemctl enable apache2 mariadb ; mysql_secure_installation

mysql -u root -p
create database db;
grant all on db.* to 'dbuser'@'localhost' identified by 'dbpass';
flush privileges;
quit

cd ~/ ; wget https://github.com/Mailtrain-org/mailtrain/archive/master.zip
unzip master.zip ; mv mailtrain-master mailtrain
cp ~/mailtrain/config/default.toml ~/mailtrain/config/production.toml
nano ~/mailtrain/config/production.toml
cd ~/mailtrain ; npm install --production


nano /etc/systemd/system/mailtrain.service
[Unit]
Description=Mailtrain Server
Requires=mariadb.service
After=syslog.target network.target

[Service]
Environment="NODE_ENV=production"
WorkingDirectory=/root/mailtrain
ExecStart=/usr/bin/node index.js
Type=simple
Restart=always
RestartSec=10
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=mailtrain

[Install]
WantedBy=multi-user.target

systemctl daemon-reload ; systemctl enable mailtrain ; systemctl start mailtrain ; systemctl status mailtrain

a2enmod proxy proxy_http rewrite
leafpad /etc/apache2/sites-available/yourdomain.conf &>/dev/null
<VirtualHost *:80>
    ServerName www.yourdomain.com
    ServerAdmin admin@yourdomain.com
    ProxyPreserveHost On
    ProxyPass / http://127.0.0.1:3000/
    ProxyPassReverse / http://127.0.0.1:3000/
    TransferLog /var/log/apache2/yourdomain_access.log
    ErrorLog /var/log/apache2/yourdomain_error.log
</VirtualHost>

a2ensite yourdomain ; a2dissite 000-default.conf  ; apache2ctl configtest ; echo "192.168.1.50 www.yourdomain.com" >> /etc/hosts ; systemctl reload apache2

http://www.yourdomain.com
Username: admin | Password: test

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

Thursday, September 10, 2020

How To Run Nextcloud in Docker Container On Ubuntu 20.04 LTS

 Video Tutorial - https://youtu.be/ExvNhU3EaKc

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

 Nextcloud is the most deployed on-premises file share and collaboration platform. - https://nextcloud.com/
Docker, and containers, are a new way of running software that is revolutionizing software development and delivery.
Docker container is a virtualized run-time environment where users can isolate applications from the underlying system.
https://hub.docker.com/_/nextcloud/
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Testing Environment:Ubuntu 20.04 LTS             Hostname - www.yourdomain.com  - ip Address - 192.168.1.10
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
apt update ; apt install -y build-essential net-tools curl git software-properties-common neofetch apt-transport-https ca-certificates curl gnupg-agent docker.io docker-compose

systemctl enable --now docker ; docker --version ; docker-compose version
usermod -aG docker $USER ; newgrp docker

docker run --name mariadb -v mariadb:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=StrongPassword -d mariadb
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mariadb
172.17.0.2

docker run --name nextcloud -v nextcloud:/var/www/html -d -p 8080:80 nextcloud
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' nextcloud

docker ps
http://192.168.1.10:8080

docker ps -q

docker stop `docker ps -q`   - docker stop 562e62f05a3a
docker start`docker ps -q`   - docker start 562e62f05a3a
docker rm 

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