Ubuntu 16.04 Installation to have a DrawMGT Vagrant Box
Contents
- Ubuntu 16.04 Installation to have a DrawMGT Vagrant Box
- OS Installation and Configuration
- Install development tools and additional packages
- Configure mysqld
- Remove PHP 7.0 and install PHP 5.6
- Configure php.ini
- Perl modules
- httpd Configuration
- Install Image Magick
- Install TexLive 2015
- Install htmldoc
- Create drawmgt User and Group
- Minimal puppet client setup
- Notes
OS Installation and Configuration
The basic Ubuntu installation is taken from the Official Ubuntu 16.04 daily Cloud Image amd64 at 2116-10-13.
Adding Virtual Machine Box
Add and start the new virtual machine box to the initialized Vagrant environment:
$ su - vagrant $ cd boxes $ wget https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-vagrant.box $ vagrant box add xenial64_base ~/boxes/xenial-server-cloudimg-amd64-vagrant.box $ mkdir vms/ubuntu16 $ cd vms/ubuntu16 $ vagrant init xenial64_base $ vagrant up
Login into the VM and Change Passwords
As default the root password is not known and vagrant password is 'vagrant' on the VM box dowloaded from Vagrant. They should be changed:
$ vagrant ssh ubuntu@ubuntu16:~$ passwd ubuntu@ubuntu16:~$ sudo bash root@ubuntu16:~# passwd
Install development tools and additional packages
It is possible to install the LAMP server (Apache, MySQL and PHP) in one step. Update all packages before do this.
root@ubuntu16:~# apt-get update root@ubuntu16:~# tasksel [*] LAMP server <Ok> root@ubuntu16:~# apt-get install vim cvs zip libhtml-parser-perl dctrl-tools postfix libperl4-corelibs-perl root@ubuntu16:~# vi /etc/vim/vimrc " Uncomment the following to have Vim jump to the last position when " reopening a file if has("autocmd") au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif endif
Currently installed versions:
root@ubuntu16:~# php -v PHP 7.0.8-0ubuntu0.16.04.3 (cli) ( NTS ) Copyright (c) 1997-2016 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies with Zend OPcache v7.0.8-0ubuntu0.16.04.3, Copyright (c) 1999-2016, by Zend Technologies root@ubuntu16:~# mysql -V mysql Ver 14.14 Distrib 5.7.15, for Linux (x86_64) using EditLine wrapper
Configure mysqld
root@ubuntu16:~# vi /etc/mysql/mysql.conf.d/mysqld.cnf # add the following lines to the end of the file (in [mysqld] section) character_set_server=utf8 innodb_buffer_pool_size = 256M innodb_lock_wait_timeout = 30 innodb_file_per_table lock_wait_timeout=30 sql-mode="" # See https://github.com/Piwigo/Piwigo/issues/376 root@ubuntu16:~# mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -uroot -psqladmin mysql # Set timezone info in the database
Retart mysql:root@ubuntu16:~# systemctl restart mysql.service
See this article if MySQL databases have to be stored in a custom directory.
Remove PHP 7.0 and install PHP 5.6
PHP 5.6 for Ubuntu 16 can be installed from PPA (Personal Package Archives) for PHP (5.6, 7.0):
Add PPA to the repositories
root@ubuntu16:~# add-apt-repository ppa:ondrej/php root@ubuntu16:~# apt-get update
Remove the currently installed PHP 7.0 packages, check the list of the packages first and complete the list below
root@ubuntu16:~# dpkg --get-selections | grep -i php root@ubuntu16:~# apt-get purge libapache2-mod-php7.0 php-common php-mysql php-pear php-xml php7.0-cli php7.0-common php7.0-dev php7.0-json php7.0-mysql php7.0-opcache php7.0-readline php7.0-xml pkg-php-tools
Install PHP 5.6 with PEAR and PEAR packages
apt-get --no-install-recommends install php5.6 php5.6-mysql php5.6-dev php5.6-xml php5.6-mbstring php-pear pear install Log Mail Mail_Mime Mail_mimeDecode Net_SMTP Net_Socket Services_JSON
Check again installed PHP 7.0 packages an remove them:
root@ubuntu16:~# dpkg --get-selections | grep -i php root@ubuntu16:~# apt-get purge ....
Install PECL packages also directly from the PPA
apt-get --no-install-recommends install php-propro php-raphf php-pecl-http
Configure php.ini
root@ubuntu16:~# cd /etc/php/5.6/apache2 root@ubuntu16:~# cp php.ini php.ini-ORIG root@ubuntu16:~# vi php.ini root@ubuntu16:~# diff php.ini-ORIG php.ini 372c372 < max_execution_time = 30 --- > max_execution_time = 120 466c466 < display_errors = Off --- > display_errors = On 572c572 < ;error_log = php_errors.log --- > error_log = /var/log/php_errors.log 660c660 < post_max_size = 8M --- > post_max_size = 128M 709c709 < ;include_path = ".:/usr/share/php" --- > include_path = ".:/usr/share/php" 820c820 < upload_max_filesize = 2M --- > upload_max_filesize = 128M 1389c1392 < ;browscap = extra/browscap.ini --- > browscap = /etc/browscap.ini 1499c1502 < session.gc_divisor = 1000 --- > session.gc_divisor = 500 1504c1507 < session.gc_maxlifetime = 1440 --- > session.gc_maxlifetime = 36000
The session timeout (timeout for automatic logout) is set also in php.ini. See Setting Session Timeout.
Install a browscap.ini file. Download php_browscap.ini from http://browscap.org/stream?q=PHP_BrowsCapINI, change the name to browscap.ini, and save it in the /etc with permission 644.
Change also /etc/php/5.6/cli/php.ini, apply only display_errors and include_path from the changes above.
Perl modules
- Add some perl modules:
root@ubuntu16:~# apt-get install libconfig-general-perl
httpd Configuration
- Apache2 (httpd) configuration is very easy, only the virtual host definitions must be added and appropriate apache modules should be loaded.
Adding Apache Modules
root@ubuntu16:~# a2enmod rewrite dav auth_digest authz_groupfile
Restart Apache
systemctl restart apache2.service
Install Image Magick
To allow to create thumbnail files ghostscript and ImageMagick must be installed. The versions in the Ubuntu distribution are quite old. Newer versions must be installed:
# Ghostscript and ImageMagick are part of the Ubuntu distribution (currently versions 9.18 and 6.8.9-9) apt-get install ghostscript imagemagick
Install TexLive 2015
To allow to create LaTeX submital/transmittal cover letters TexLive >= 2011 must be installed.
root@ubuntu16:~# apt-get install texlive latexmk texlive-latex-extra
Install htmldoc
root@ubuntu16:~# apt-get install htmldoc
Create drawmgt User and Group
root@ubuntu16:~# adduser --uid=1003 drawmgt root@ubuntu16:~# usermod -a -G www-data drawmgt root@ubuntu16:~# usermod -a -G drawmgt www-data
Minimal puppet client setup
vagrant@xenial-rails:~$ sudo su - root@:~# apt install puppet-common root@ubuntu16:~# cd /etc/puppet root@ubuntu16:~# rm -rf [efmt]* root@ubuntu16:~# vi puppet.conf [agent] server = puppet report = true
Notes
MySQL Passwords
Use ~/-my.cnf instead of command line passwords for all DrawMGT users using mysqlcopy.pl or backupClient.pl to avoid problems caused by the warning of current MySQL version: mysql: [Warning] Using a password on the command line interface can be insecure.
Use mysqlcopy.pl without -p option and do not define password in the configuration file for backupClient.pl.[mysqldump] user=root password=sqladmin [mysql] user=root password=sqladmin