Docker Install: Difference between revisions

From RAJ INFO
Jump to navigation Jump to search
 
(21 intermediate revisions by the same user not shown)
Line 14: Line 14:
<pre>
<pre>
apt update && upgrade
apt update && upgrade
apt install wget nano curl libpam-modules-bin libpam-modules libpam-runtime libpam0g libsystemd0 libudev1 zip rar htop net-tools imagemagick php-gd
apt install wget nano curl libpam-modules-bin libpam-modules libpam-runtime libpam0g libsystemd0 libudev1 zip rar gzip pigz tar htop net-tools imagemagick php-gd python3 cron libpython3.14-minimal libpython3.14-stdlib python3.14-minimal python3.14 php-fpm
</pre>
</pre>


Line 84: Line 84:
cp -r cp -r /opt/www/backup/www/ /var/ && chown -R www-data:www-data /var/www
cp -r cp -r /opt/www/backup/www/ /var/ && chown -R www-data:www-data /var/www
</pre>
</pre>
* Crontab : Apache  automation
<pre>
3 * * * * /var/www/tools/apache_service_monitor.py
</pre>
== Mediawiki ==
== Mediawiki ==
<pre>
<pre>
cd /var/www/rajkumar && mv root root.old && wget https://releases.wikimedia.org/mediawiki/1.43/mediawiki-1.43.1.tar.gz && tar xzvf mediawiki-1.43.1.tar.gz && mv mediawiki-1.43.1 root && chown -R www-data:www-data root && cp -r root.old/images root/
cd /var/www/rajkumar && mv root root.old && wget https://releases.wikimedia.org/mediawiki/1.43/mediawiki-1.43.1.tar.gz && tar xzvf mediawiki-1.43.1.tar.gz && mv mediawiki-1.43.1 root && chown -R www-data:www-data root && cp -r root.old/images root/ && cp -r root.old/extensions/MsUpload root/extensions/ && cp -r root.old/extensions/Iframe root/extensions/
 
 
rm -fr root && wget https://releases.wikimedia.org/mediawiki/1.40/mediawiki-1.40.0.tar.gz && tar xzvf mediawiki-1.40.0.tar.gz && mv mediawiki-1.40.0 root && chown -R www-data:www-data root && nano root/LocalSettings.php
 
</pre>
</pre>
* Web install and configure
* Web install and configure
Line 93: Line 103:
$wgDBserver = "172.20.0.10";
$wgDBserver = "172.20.0.10";
$wgLocaltimezone = "Asia/Kolkota";
$wgLocaltimezone = "Asia/Kolkota";
$wgFavicon = "/images/favicon.png";


</pre>
* Old Extensions


<pre>


wfLoadExtension( 'MsUpload' );
wfLoadExtension( 'MsUpload' );
 
wfLoadExtension( 'YouTube' );


$wgMSU_useDragDrop = true; // Should the drag & drop area be shown?
$wgMSU_useDragDrop = true; // Should the drag & drop area be shown?
$wgMSU_showAutoCat = true; // Files uploaded while editing a category page will be added to that cat>
$wgMSU_showAutoCat = true; // Files uploaded while editing a category page will be added to that category
$wgMSU_checkAutoCat = true; // Whether the checkbox for adding a category to a page is checked by de>
$wgMSU_checkAutoCat = true; // Whether the checkbox for adding a category to a page is checked by default
$wgMSU_useMsLinks = true; // Insert links in Extension:MsLinks style?
$wgMSU_useMsLinks = true; // Insert links in Extension:MsLinks style?
$wgMSU_confirmReplace = true; // Show the "Replace file?" checkbox
$wgMSU_confirmReplace = true; // Show the "Replace file?" checkbox
$wgMSU_imgParams = '400px'; // Default image parameters, for example "thumb|200px"
$wgMSU_imgParams = '400px'; // Default image parameters, for example "thumb|200px"
$wgMSU_uploadsize = '500mb'; // Max upload size through MsUpload
$wgMSU_uploadsize = '500mb'; // Max upload size through MsUpload
$wgEnableUploads = true; // Enable uploads
# $wgMimeTypeExclusions = [ ... ]; // Remove "application/java" from this configuration parameter. S>
$wgGroupPermissions['user']['upload'] = true; // Allow regular users to upload files
$wgGroupPermissions['user']['upload'] = true; // Allow regular users to upload files
$wgFileExtensions = [ 'png', 'gif', 'jpg', 'jpeg', 'doc' ,'xls', 'pdf', 'ppt', 'tiff', 'bmp', 'docx'>
$wgAllowJavaUploads = true; #Deprecated: Removed in 1.39+
$wgVerifyMimeType = false;
$wgVerifyMimeType = false;
$wgAllowJavaUploads = true;


require_once("/var/www/.config/global_wiki_config.php");


</pre>


wfLoadExtension('Iframe');
* Protecting the Images in Wiki
$wgIframe = array();
Add the following code to ../lampp/etc/httpd.conf
$wgIframe['server']['mykey'] = [ 'scheme' => 'https', 'domain' => 'rajkumar.in' ];


 
<pre>
require_once("/var/www/.config/global_wiki_config.php");
<Directory "/var/www/[0-9|a-z]*/root/images">
----------
 
<Directory "/var/www/rajkmar/root/images">
   AllowOverride None
   AllowOverride None
   AddType text/plain .html .htm .shtml .phtml
   AddType text/plain .html .htm .shtml .phtml
Line 136: Line 143:
== Drupal ==
== Drupal ==
<pre>
<pre>
ap install composer
apt install composer


cd /var/www/ && rm -fr idon && wget https://ftp.drupal.org/files/projects/drupal-10.5.0.tar.gz && tar xzvf drupal-10.5.0.tar.gz && mv drupal-10.5.0 idon && chown -R www-data:www-data idon && mkdir idon/sites/default/files && chmod 777 idon/sites/default/files && cp idon/sites/default/default.settings.php idon/sites/default/settings.php && chmod 777 idon/sites/default/settings.php
cd /var/www/ && rm -fr idon && wget https://ftp.drupal.org/files/projects/drupal-10.5.0.tar.gz && tar xzvf drupal-10.5.0.tar.gz && mv drupal-10.5.0 idon && chown -R www-data:www-data idon && mkdir idon/sites/default/files && chmod 777 idon/sites/default/files && cp idon/sites/default/default.settings.php idon/sites/default/settings.php && chmod 777 idon/sites/default/settings.php
</pre>
----
* opcache
*Add this to php.ini
<pre>
[opcache]
zend_extension=opcache.so
openssl.cafile=/opt/lampp/share/curl/curl-ca-bundle.crt
opcache.memory_consumption=256
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=6000
opcache.revalidate_freq=60
opcache.fast_shutdown=1 ; prior to PHP 7.2.0
opcache.enable_cli=1
</pre>
* Set up the web interface
<pre>
chmod 644 idon/sites/default/settings.php
</pre>
----------
* Extensions Youtube
<pre>
apt-get install php-xml
composer require 'drupal/youtube:^2.0'
composer require drupal/video_embed_field
</pre>
</pre>


Line 148: Line 182:
rm wp.txt
rm wp.txt
</pre>
</pre>
== .htaccess ==
* Create a .htaccess file
<pre>
AuthType Basic
AuthName "Restricted Area"
AuthUserFile /etc/apache2/.htpasswd
Require valid-user
</pre>
* Create encrypted password
<pre>
htpasswd -c /var/www/.config/.htpasswd username
</pre>
== SSL Apache config ==
<pre>
# SSL horts.in
<VirtualHost *:443>
    ServerAdmin r@rajkumar.in
    DocumentRoot "/var/www/horts/root"
    ServerName horts.in
    ServerAlias www.horts.in
    SSLEngine on
    SSLCertificateFile      "/opt/lampp/etc/ssl/rajkumar.in.certificate.crt"
    SSLCertificateKeyFile  "/opt/lampp/etc/ssl/rajkumar.in.private.key"
    SSLCertificateChainFile "/opt/lampp/etc/ssl/rajkumar.in.ca_bundle.crt"
    ErrorLog "logs/horts.in-error_log"
    CustomLog "logs/horts.in-access_log" common
    <Directory "/var/www/horts/root">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride all
        Order Deny,Allow
        Allow from all
        Require all granted
    </Directory>
</VirtualHost>
</pre>
https://www.rajkumar.in/index.php/Main_Page
https://www.horts.in/index.php/Main_Page

Latest revision as of 03:22, 9 July 2026

SERVER CONFIGURATION

DOCKER

docker pull ubuntu:24.04
docker run -it --name web -p 8080:80 -p 21:21 --network idon ubuntu:24.04

IP

docker network connect --ip 172.17.0.10 idon mysql
docker network connect --ip 172.17.0.2 idon web

UPDATE

apt update && upgrade
apt install wget nano curl libpam-modules-bin libpam-modules libpam-runtime libpam0g libsystemd0 libudev1 zip rar gzip pigz tar htop net-tools imagemagick php-gd python3 cron libpython3.14-minimal libpython3.14-stdlib python3.14-minimal python3.14 php-fpm

Lampp

cd /opt && wget https://excellmedia.dl.sourceforge.net/project/xampp/XAMPP%20Linux/8.2.12/xampp-linux-x64-8.2.12-0-installer.run && chmod 77 xampp-linux-x64-8.2.12-0-installer.run && ./xampp-linux-x64-8.2.12-0-installer.run

change user / group in httpd.conf as www-data

ProFTP

useradd admin
passwd admin
groupadd ftp
usermod -a -G ftp admin
chown root:ftp htdocs
chmod 775 htdocs

Mysql

  • Separate container
  • Assign IP (Refer earlier)
  • > map > mkdir /opt/www -> /volume1/www

Restore

./mysql -u rajplus -p -h localhost ak_wiki </opt/www/backup/mysql/ak_wiki.sql

phpmyadmin

  • Edit /etc/extra/httpd-xampp.conf
Require all granted
  • Access throug web interface and add user and block root
mkdir /opt/save
mkdir /opt/upload
  • Edit Config.inc.php
declare(strict_types=1);
$cfg['blowfish_secret'] = 'xampp'; /* YOU SHOULD CHANGE THIS FOR A MORE SECURE COOKIE AUTH! */
$i = 0;
$i++;
$cfg['Servers'][$i]['auth_type'] = 'http';
$cfg['Servers'][$i]['user'] = 'rajplus';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['host'] = '172.17.0.7';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = false;
$cfg['UploadDir'] = '/opt/upload';
$cfg['SaveDir'] = '/opt/save';

APCU

apt install php8.3-dev
pecl channel-update pecl.php.net
pecl install apcu
  • You should add "extension=apcu.so" to php.ini
  • echo "extension=apcu.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`

WEB FOLDERS

www

cp -r cp -r /opt/www/backup/www/ /var/ && chown -R www-data:www-data /var/www
  • Crontab : Apache automation
3 * * * * /var/www/tools/apache_service_monitor.py

Mediawiki

cd /var/www/rajkumar && mv root root.old && wget https://releases.wikimedia.org/mediawiki/1.43/mediawiki-1.43.1.tar.gz && tar xzvf mediawiki-1.43.1.tar.gz && mv mediawiki-1.43.1 root && chown -R www-data:www-data root && cp -r root.old/images root/ && cp -r root.old/extensions/MsUpload root/extensions/ && cp -r root.old/extensions/Iframe root/extensions/ 


rm -fr root && wget https://releases.wikimedia.org/mediawiki/1.40/mediawiki-1.40.0.tar.gz && tar xzvf mediawiki-1.40.0.tar.gz && mv mediawiki-1.40.0 root && chown -R www-data:www-data root && nano root/LocalSettings.php

  • Web install and configure
  • LocalSettings.php
$wgDBserver = "172.20.0.10";
$wgLocaltimezone = "Asia/Kolkota";
$wgFavicon = "/images/favicon.png";

  • Old Extensions

wfLoadExtension( 'MsUpload' );
wfLoadExtension( 'YouTube' );

$wgMSU_useDragDrop = true; // Should the drag & drop area be shown?
$wgMSU_showAutoCat = true; // Files uploaded while editing a category page will be added to that category
$wgMSU_checkAutoCat = true; // Whether the checkbox for adding a category to a page is checked by default
$wgMSU_useMsLinks = true; // Insert links in Extension:MsLinks style?
$wgMSU_confirmReplace = true; // Show the "Replace file?" checkbox
$wgMSU_imgParams = '400px'; // Default image parameters, for example "thumb|200px"
$wgMSU_uploadsize = '500mb'; // Max upload size through MsUpload
$wgGroupPermissions['user']['upload'] = true; // Allow regular users to upload files
$wgVerifyMimeType = false;

require_once("/var/www/.config/global_wiki_config.php");

  • Protecting the Images in Wiki

Add the following code to ../lampp/etc/httpd.conf

<Directory "/var/www/[0-9|a-z]*/root/images">
   AllowOverride None
   AddType text/plain .html .htm .shtml .phtml
   php_admin_flag engine off
   Header set X-Content-Type-Options nosniff
</Directory>


Drupal

apt install composer

cd /var/www/ && rm -fr idon && wget https://ftp.drupal.org/files/projects/drupal-10.5.0.tar.gz && tar xzvf drupal-10.5.0.tar.gz && mv drupal-10.5.0 idon && chown -R www-data:www-data idon && mkdir idon/sites/default/files && chmod 777 idon/sites/default/files && cp idon/sites/default/default.settings.php idon/sites/default/settings.php && chmod 777 idon/sites/default/settings.php

  • opcache
  • Add this to php.ini
[opcache]
zend_extension=opcache.so
openssl.cafile=/opt/lampp/share/curl/curl-ca-bundle.crt

opcache.memory_consumption=256
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=6000
opcache.revalidate_freq=60
opcache.fast_shutdown=1 ; prior to PHP 7.2.0
opcache.enable_cli=1
  • Set up the web interface
chmod 644 idon/sites/default/settings.php

  • Extensions Youtube
apt-get install php-xml
composer require 'drupal/youtube:^2.0'
composer require drupal/video_embed_field

Encrypt MD5

  • Create a file called wp.txt, containing nothing but the new password.
tr -d ‘\r\n’ < wp.txt | md5sum | tr -d ‘ -‘
rm wp.txt

.htaccess

  • Create a .htaccess file
AuthType Basic
AuthName "Restricted Area"
AuthUserFile /etc/apache2/.htpasswd
Require valid-user
  • Create encrypted password
htpasswd -c /var/www/.config/.htpasswd username

SSL Apache config

# SSL horts.in
<VirtualHost *:443>
    ServerAdmin r@rajkumar.in
    DocumentRoot "/var/www/horts/root"
    ServerName horts.in
    ServerAlias www.horts.in

    SSLEngine on
    SSLCertificateFile      "/opt/lampp/etc/ssl/rajkumar.in.certificate.crt"
    SSLCertificateKeyFile   "/opt/lampp/etc/ssl/rajkumar.in.private.key"
    SSLCertificateChainFile "/opt/lampp/etc/ssl/rajkumar.in.ca_bundle.crt"

    ErrorLog "logs/horts.in-error_log"
    CustomLog "logs/horts.in-access_log" common

    <Directory "/var/www/horts/root">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride all
        Order Deny,Allow
        Allow from all
        Require all granted
    </Directory>

</VirtualHost>

https://www.rajkumar.in/index.php/Main_Page https://www.horts.in/index.php/Main_Page