October 2014 / PhreeBooksR36RC3
Author – Greg

Ubuntu Server

Installing PhreeBooks on Ubuntu Server 14.04
First you will need to download Ubuntu Server:
http://www.ubuntu.com/download/server

Then Install it. Only installing SSH Server, You dont need to install LAMP:

Source – HowtoForge

http://www.howtoforge.com/perfect-server-ubuntu-14.04-apache2-php-mysql-pureftpd-bind-dovecot-ispconfig-3-p2
3. The Base System

  • Insert your Ubuntu install CD into your system and boot from it. Select your language.
  • Then select Install Ubuntu Server:
  • Choose your language again (?):
  • Then select your location:
  • Choose a keyboard layout (you will be asked to press a few keys, and the installer will try to detect your keyboard layout based on the keys you pressed) In my case I prefer ‘No’ & keyboard layout as ‘English US’.
  • The installer checks the installation CD, your hardware, and configures the network with DHCP if there is a DHCP server in the network
  • Enter the hostname. In this example, my system is called server1.example.com , so I enter ‘server1’
  • Create a user, for example the user administrator with the user name administrator (don’t use the user name ‘admin’ as it is a reserved name on Ubuntu 14.04):
  • Choose a password. I don’t need an encrypted private directory, so I choose ‘No’ here
  • Please check if the installer detected your time zone correctly. If so, select Yes, otherwise No:

Now you have to partition your hard disk. For simplicity’s sake I select ‘Guided – use entire disk and set up LVM’ – this will create one volume group with two logical volumes, one for the / file system and another one for swap (of course, the partitioning is totally up to you – if you know what you’re doing, you can also set up your partitions manually).

  • Select the disk that you want to partition:
  • When you’re asked Write the changes to disks and configure LVM?, select Yes:
  • If you have selected Guided – use entire disk and set up LVM, the partitioner will create one big volume group that uses all the disk space. You can now specify how much of that disk space should be used by the logical volumes for / and swap. It makes sense to leave some space unused so that you can later on expand your existing logical volumes or create new ones – this gives you more flexibility.
  • When you’re finished, hit Yes when you’re asked Write the changes to disks?

Afterwards, your new partitions are being created and formatted.
Now the base system is being installed:

Next the package manager apt gets configured. Leave the HTTP proxy line empty unless you’re using a proxy server to connect to the Internet:

I’m a little bit old-fashioned and like to update my servers manually to have more control, therefore I select No automatic updates. Of course, it’s up to you what you select here:

We need a DNS, mail, and LAMP server, but nevertheless I don’t select any of them now because I like to have full control over what gets installed on my system. We will install the needed packages manually later on. The only item I select here is OpenSSH server so that I can immediately connect to the system with an SSH client such as PuTTY (Windows) after the installation has finished:

The installation continues:

  • Select Yes when you are asked Install the GRUB boot loader to the master boot record?:
  • The base system installation is now finished. Remove the installation CD from the CD drive and hit Continue to reboot the system:
  • Next you are going to want to set you ip address of your machine. Change /etc/network/interfaces to look like this.

# This file describes the network interfaces available on your system

# and how to activate them. For more information, see interfaces(5).
# The loopback network interface

auto lo

iface lo inet loopback
# The primary network interface

auto eth0

#iface eth0 inet dhcp

iface eth0 inet static

address 192.168.1.5

netmask 255.255.255.0

gateway 192.168.1.1

dns-nameservers 8.8.8.8 8.8.4.4 

Now you can use SSH to connect to the server and set lamp and php up.

Source – HowtoForge: Installing Apache2 With PHP5 And MySQL Support On Ubuntu 14.04LTS (LAMP)

http://www.howtoforge.com/ubuntu-lamp-server-with-apache2-php5-mysql-on-14.04-lts

Author: Falko Timme, updated by Srijan Kishore – Version 1.0
Last edited 29/Apr/2014

LAMP is short for L inux, A pache, M ySQL, P HP. This tutorial shows how you can install an Apache2 webserver on an Ubuntu 13.04 server with PHP5 support (mod_php) and MySQL support.
I do not issue any guarantee that this will work for you!

1. Preliminary Note
In this tutorial I use the hostname server1.example.com with the IP address 192.168.1.5. These settings might differ for you, so you have to replace them where appropriate.
I’m running all the steps in this tutorial with root privileges, so make sure you’re logged in as root:
sudo su

2. Installing MySQL 5
First we install MySQL 5 like this:
apt-get install mysql-server mysql-client
You will be asked to provide a password for the MySQL root user – this password is valid for the user root@localhost as well as root@server1.example.com, so we don’t have to specify a MySQL root password manually later on:
New password for the MySQL “root” user: <– yourrootsqlpassword

Repeat password for the MySQL “root” user: <– yourrootsqlpassword

3. Installing Apache2
Apache2 is installed by default in ubuntu14.04, If not installed then install it. Apache2 is available as an Ubuntu package, therefore we can install it like this:
apt-get install apache2
Now direct your browser to http://192.168.1.5, and you should see the Apache2 placeholder page (It works!):

Apache’s default document root is /var/www/html on Ubuntu, and the configuration file is /etc/apache2/apache2.conf. The configuration system is fully documented in /usr/share/doc/apache2/README.Debian.gz

4. Installing PHP5
We can install PHP5 and the Apache PHP5 module as follows:
apt-get install php5 libapache2-mod-php5
We must restart Apache afterwards:
service apache2 restart

5. Testing PHP5 / Getting Details About Your PHP5 Installation
The document root of the default web site is /var/www/html. We will now create a small PHP file (info.php) in that directory and call it in a browser. The file will display lots of useful details about our PHP installation, such as the installed PHP version.
vi /var/www/html/info.php   …   (‘vi’ being the text editor)


<?php
phpinfo();
?>

Now we call that file in a browser (e.g. http://192.168.1.5/info.php):

As you see, PHP5 is working, and it’s working through the Apache 2.0 Handler, as shown in the Server API line. If you scroll further down, you will see all modules that arealready enabled in PHP5. MySQL is not listed there which means we don’t have MySQL support in PHP5 yet.

6. Getting MySQL Support In PHP5
To get MySQL support in PHP, we can install the php5-mysql package. It’s a good idea to install some other PHP5 modules as well asyou might need them for your applications. You can search for available PHP5 modules like this:
apt-cache search php5
Pick the ones you need and install them like this:
apt-get install php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
Now restart Apache2:
service apache2 restart
Xcache is a free and open PHP opcode cacher for caching and optimizing PHP intermediate code. It’s similar to other PHP opcode cachers, such as eAccelerator and APC. It is strongly recommended to have one of these installed to speed up your PHP page.
Xcache can be installed as follows:
apt-get install php5-xcache
Now restart Apache:
service apache2 restart
Now reload http://192.168.1.5/info.php in your browser and scroll down to the modules section again. You should now find lots of new modules there, including the MySQL module:

7. phpMyAdmin
phpMyAdmin is a web interface through which you can manage your MySQL databases. It’s a good idea to install it:
apt-get install phpmyadmin
You will see the following questions:
Web server to reconfigure automatically: <– apache2

Configure database for phpmyadmin with dbconfig-common? <– No
Afterwards, you can access phpMyAdmin under http://192.168.1.5/phpmyadmin

[edit – I have read that one needs to apply a higher degree of security to phpMyAdmin – or any other database manager (particularly if your install is ‘internet facing’). Amoungst the recommendations (but not limited to these) were (1) not to call any directories or Users by obvious (easily guessed) names e.g. ‘phpMyAdmin’ – use long names, and (2) to use appropriately long, properly random passwords everywhere (including database Users). See the Database and Encryption articles (‘Resources’ at bottom of page) for more]

 [edit II – please ensure that the MySQL database default ‘Table Type’ is set to InnoDB (and not to MyISAM). The journal_main and journal_item tables MUST be InnoDB]

PhreeBooks Install:

Now we need to setup a database for PhreeBooks to use.
When logged into phpmyadmin go to ->Users ->Add Users ->

  • Enter a user name
  • enter Host as ‘localhost’
  • your password and re-type (make a note of this !!!)

Then check:

X Create database with same name and grant all privileges

X Grant all privileges on wildcard name (username\_%)
Click Global Privileges Check All
and Create

Next you will need to use ftp (or alternatively scp) to upload phreedom to the server. So we will install vsftpd
sudo apt-get install vsftpd

now edit the config file by

nano edit/etc/vsftpd.conf

Change the Following Lines:


write_enable=YES

chroot_local_user=YES

and restart vsftpd

sudo service vstfpd restart

Connect to with your favorite ftp client and create a folder called /home/user/erp (replace user with your user) and upload PhreeBooks to /home/user/erp
next you will need to setup apache to point to the spot on the server that you want your domain to use.
navigate to /etc/apache2/sites-enabled:
cd /etc/apache2/sites-enabled
then create a file with your domain like mydomain.com.conf
sudo nano mydomain.com.conf
Here you will enter your domain information


<VirtualHost *:80>
ServerAdmin youremail@yourdomain.com
ServerName mydomain.com
ServerAlias www.mydomain.com
DocumentRoot /home/user/erp

# New directive needed in Apache 2.4.3:
<Directory /home/user/erp>
Order allow,deny
Allow from all
# Options Index FollowSymLinks MultiViews
AllowOverride All
# New directive needed in Apache 2.4.3:
Require all granted
</Directory>

</VirtualHost>

then save it by using ctrl + c -> yes
Now restart Apache
sudo service apache2 restart

Now We need to set permissions for PhreeBooks
sudo chmod 777 -R /home/user/erp

[edit – how about chown ?
Also, that 777 permission above will need to be tightened up immediately post-install. This is hugely important and VITAL for the security of your PhreeBooks install. For further guidance see the SMEserver HowTo – Section 11]

Now Browse to mydomain.com/install

  • Read the Agreement and Click Accept
  • Click Install
  • Fill Out Your Information
  • [edit – HTTPS connections are recommended – select on the setup page]
  • Follow the instructions regarding setting up your PhreeBooks instance on the ‘Home’ page.

Bam, DONE!

Please post and feedback, questions or suggestions for improvement to the Forum.