Ubuntu 12.04 Installation to have a DrawMGT Vagrant Box
Contents
- Ubuntu 12.04 Installation to have a DrawMGT Vagrant Box
- OS Installation and Configuration
- Install development tools and additional packages
- Configure mysqld
- Install additional php packages and pear
- Configure php.ini
- httpd Configuration
- Install PHP PEAR Modules
- Install Image Magick
- Install TexLive 2012
- Install htmldoc
- Puppet Jobs
- System Administration Commands
OS Installation and Configuration
The basic Ubuntu installation is taken from a preloaded Vagrant box zg-3.softxs.ch:/home/vagrant/boxes/precise64_base.box which is derived from the official Vagrant box precise64 containing Ubuntu 12.04.3 LTS with Ruby 1.8.7.
Adding Virtual Machine Box
Add and start the new virtual machine box to the initialized Vagrant environment:
$ su - vagrant $ scp vagrant@zg-3.softxs.ch:/home/vagrant/boxes/precise64_base.box /tmp $ vagrant box add precise64_base /tmp/precise64_base.box $ mkdir vms/drawmgt $ cd vms/drawmgt $ vagrant init precise64_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 vagrant@v2:~$ passwd vagrant@v2:~$ sudo root@v2:~# 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@v2:~# apt-get update root@v2:~# tasksel [*] LAMP server <Ok> root@v2:~# apt-get install vim cvs zip libhtml-parser-perl dctrl-tools chkconfig postfix root@v2:~# ln -s /usr/lib/insserv/insserv /sbin/insserv # otherwise chkconfig does not work
Currently installed versions:
root@v2:~# php -v PHP 5.3.10-1ubuntu3.15 with Suhosin-Patch (cli) (built: Oct 29 2014 12:19:04) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies root@v2:~# mysql -V mysql Ver 14.14 Distrib 5.5.40, for debian-linux-gnu (x86_64) using readline 6.2
Configure mysqld
root@v2:~# vi /etc/mysql/conf.d/DrawMGT.conf [mysqld] character_set_server=utf8 innodb_buffer_pool_size = 256M innodb_additional_mem_pool_size = 32M innodb_lock_wait_timeout = 30 innodb_file_per_table # From mysql 5.5.3 use lock_wait_timeout instead of table_lock_wait_timeout lock_wait_timeout=30
Start mysql at boot:root@v2:~# chkconfig mysql 2345
Install additional php packages and pear
root@v2:~# apt-get install php-pear root@v2:~# apt-get install make php5-dev libcurl4-gnutls-dev # needed for pecl/http
Note that you might get errors that state the the version of pear is too low to be able to installed the desired package. In this case you must upgrade pear (pear upgrade --force pear)
Configure php.ini
root@v2:~# cd /etc/php5/apache2 root@v2:~# cp php.ini php.ini-ORIG root@v2:~# diff php.ini-ORIG php.ini 334c334 < allow_call_time_pass_reference = Off --- > allow_call_time_pass_reference = On 444c444 < max_execution_time = 30 --- > max_execution_time = 120 538c538 < display_errors = Off --- > display_errors = On 643c643 < ;error_log = php_errors.log --- > error_log = /var/log/php_errors.log 740c740 < post_max_size = 8M --- > post_max_size = 128M 796c796 < ;include_path = ".:/usr/share/php" --- > include_path = ".:/usr/share/php" 891c891 < upload_max_filesize = 2M --- > upload_max_filesize = 128M 951a952 > extension=http.so 1408c1409 < ;browscap = extra/browscap.ini --- > browscap = /etc/browscap.ini 1510c1511 < session.gc_divisor = 1000 --- > session.gc_divisor = 500 1515c1516 < 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=Lite_PHP_BrowsCapINI, change the name to browscap.ini, and save it in the /etc with permission 644.
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@v2:~# cd /etc/apache2/mods-enabled # load apache modules root@v2:~# ln -s ../mods-available/rewrite.load . # RewriteEngine root@v2:~# ln -s ../mods-available/dav* . # Dav root@v2:~# ln -s ../mods-available/auth_digest.load . # AuthDigestProvider
Adding Virtual Host
Virtual host will be added probably by Puppet. See end of thes page.
Install PHP PEAR Modules
apt-get install libpcre3-dev pear install Log Mail Mail_Mime Mail_mimeDecode Net_SMTP Net_Socket Services_JSON pear install pecl/propro # Add the extension to the section "Dynamic Extensions" in php ini files vi /etc/php5/cli/php.ini extension=propro.so vi /etc/php5/apache2/php.ini extension=propro.so pear install pecl/raphf # Add the extension to the section "Dynamic Extensions" in php ini files vi /etc/php5/cli/php.ini extension=raphf.so vi /etc/php5/apache2/php.ini extension=raphf.so pear install pecl/pecl_http # Add the extension to the section "Dynamic Extensions" in php ini files vi /etc/php5/cli/php.ini extension=http.so vi /etc/php5/apache2/php.ini extension=http.so
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 must be installed from source wget --no-proxy http://downloads.ghostscript.com/public/ghostscript-9.15.tar.bz2 tar xvf ghostscript-9.15.tar.bz2 cd ghostscript-9.15 ./configure make make install cd ., rm -rf ghostscript-9.15* # ImageMagick is part of the Ubuntu distribution (currently version 6.6.9-7) apt-get install imagemagick # Edit ImageMagick configuration to use the newer ghostscript cp /etc/ImageMagick/delegates.xml /etc/ImageMagick/delegates.xml.ORIG vi /etc/ImageMagick/delegates.xml :%s:"gs":\"/usr/local/bin/gs\":g :x
Install TexLive 2012
To allow to create LaTeX submital/transmittal cover letters TexLive 2011 or 2012 must be installed.
TeX Live 2012 is scheduled to be included in Ubuntu 12.10 (Quantal). There is also an offical "backports" PPA for Ubuntu 12.04 (Precise) users. To install/upgrade to TeX Live 2012, follow these steps from the terminal as root:
root@v2:~# apt-get install python-software-properties # Needed for root@v2:~# apt-add-repository ppa:texlive-backports/ppa # Add the texlive-backports PPA root@v2:~# apt-get update # Update APT package index # Install TexLive with additional language packages root@v2:~# apt-get install texlive latexmk texlive-latex-extra root@v2:~# apt-get install texlive-lang-vietnamese texlive-lang-hungarian texlive-lang-german root@v2:~# mkdir /usr/share/texlive/texmf/tex/latex/ltablex/ root@v2:~# cd /usr/share/texlive/texmf/tex/latex/ltablex/ root@v2:~# wget http://ctan.ijs.si/tex-archive/macros/latex/contrib/ltablex/ltablex.sty root@v2:~# texhash
Install htmldoc
root@v2:~# apt-get install htmldoc
Puppet Jobs
Adding Virtual Host
- The example below adds an IDP virtual host:
root@v2:~# cd /etc/apache2 root@v2:~# vi sites-available/idp # add virtual host definition (see content in the next block) root@v2:~# cd sites-enabled root@v2:~# ln -s ln -s ../sites-available/idp 001-idp # enable the new virtual host
The virtual host definition in sites-available/idp:
<VirtualHost *:80> DocumentRoot /home/idp/www/html ServerName idp.tibi1959.hu ServerAlias idp Options -Indexes # -- IDP WebDAV -- prod Alias /prod/upload "/home/idp/www/html/prod/var/idp/zg.softxs.ch-prod/data/upload" <Directory "/home/idp/www/html/prod/var/idp/zg.softxs.ch-prod/data/upload"> RewriteEngine Off Dav On Order Allow,Deny Allow from all AuthType Basic AuthName DAV-upload AuthDigestProvider file AuthUserFile "/home/idp/www/html/prod/var/idp/zg.softxs.ch-prod/config/user.passwd" Require valid-user AddDefaultCharset UTF-8 </Directory> # -- IDP WebDAV -- test Alias /test/upload "/home/idp/www/html/test/var/idp/zg.softxs.ch-test/data/upload" <Directory "/home/idp/www/html/test/var/idp/zg.softxs.ch-test/data/upload"> RewriteEngine Off Dav On Order Allow,Deny Allow from all AuthType Basic AuthName DAV-upload AuthDigestProvider file AuthUserFile "/home/idp/www/html/test/var/idp/zg.softxs.ch-test/config/user.passwd" Require valid-user AddDefaultCharset UTF-8 Options +Indexes </Directory> # -- IDP WebDAV -- beta Alias /beta/upload "/home/idp/www/html/idp116beta/var/idp/zg.softxs.ch-beta/data/upload" <Directory "/home/idp/www/html/idp116beta/var/idp/zg.softxs.ch-beta/data/upload"> RewriteEngine Off Dav On Order Allow,Deny Allow from all AuthType Basic AuthName DAV-upload AuthDigestProvider file AuthUserFile "/home/idp/www/html/idp116beta/var/idp/zg.softxs.ch-beta/config/user.passwd" Require valid-user AddDefaultCharset UTF-8 </Directory> </VirtualHost>
User Setup
Add group and user idp:
root@v2:~# groupadd idp root@v2:~# useradd idp -c'IDP DrawMGT User' -g idp -G www-data root@v2:~# usermod www-data -G idp
System Administration Commands
- To start/stop services:
root@v2:~# /etc/init.d/{service_script} [start | stop | restart | status]
Important values for service_script: apache2, mysql. To enable/disable services at boot: use 'chkconfig' and/or 'service'
chkconfig --list # List services and whether they are enabled/disabled at each run level chkconfig {service} on|off
To shutdown the system:init 0
List all available packages:aptitude -F "%p" search "?not(?installed)"
List all installed packages:grep-available -s Package .