Friday, November 20, 2015

Partkeepr Installation on Centos 6.4



PartKeepr is an electronic parts inventory management software. It helps you to keep track of your available parts and assist you with re-ordering parts.
We’ll be starting with a base install of CentOS 6.3 assuming nothing already installed. Don’t forget to enable port 80 on the firewall or disable it if you prefer.

Disable SELinux

setenforce 0

Disable SELinux on startup

vi /etc/syscofig/selinux

Change the enforcing parameter

enforcing=disabled

We’ll need the EPEL repository for Imagick

rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm


Install base requirements

yum install httpd mysql-server mysql php php-mysql php-pear php-pecl-imagick php-gd

Install Doctrine requirements

pear channel-discover pear.symfony.com
pear channel-discover pear.doctrine-project.org
pear install pear.doctrine-project.org/DoctrineORM
pear install pear.doctrine-project.org/DoctrineSymfonyConsole
pear install pear.doctrine-project.org/DoctrineSymfonyYaml
pear channel-discover pear.twig-project.org
pear install twig/Twig

Set Apache and MySQL to autostart

chkconfig httpd on
chkconfig mysqld on

Start Apache and MySQL

service httpd start
service mysqld start


Let’s secure the MySQL server

/usr/bin/mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we’ll need the current
password for the root user. If you’ve just installed MySQL, and
you haven’t set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on…
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
… Success!
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y
… Success!
Normally, root should only be allowed to connect from ‘localhost’. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y
… Success!
By default, MySQL comes with a database named ‘test’ that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y
– Dropping test database…
… Success!
– Removing privileges on test database…
… Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
… Success!
Cleaning up…
All done! If you’ve completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!

Setup the partkeepr database

Login to mysql shell

mysql -u root -p

Create database

CREATE DATABASE partkeepr CHARACTER SET utf8;

Create user and assign permissions

GRANT ALL PRIVILEGES ON partkeepr.* TO partkeepr@localhost IDENTIFIED BY 'partkeeprpass';
exit

Download the current version of PartKeepr.  I like to keep most of my files in the home directory for simple backup purposes, but put these where ever you want.

cd /home
wget http://partkeepr.org/downloads/partkeepr-0.1.8.zip
unzip partkeepr-0.1.8.zip

Link ‘partkeeper to the version specific directory. This way for unpgrade we can easily keep our old version files and just update the link to the new version.

ln -s /home/partkeepr-0.1.8 /home/partkeepr
Make the data directory writable by apache
chmod 777 /home/partkeepr/data -R

Create an empty config file and make writeable by apache

touch /home/partkeepr/config.php
chmod 777 /home/partkeepr/config.php

Now create an apache config file
vi /etc/httpd/conf.d/partkeepr.conf
Add this content and adjust as neccessary for your configuration
<VirtualHost *:80>
ServerName partkeepr
DocumentRoot /home/partkeepr/frontend
DirectoryIndex index.php
rewriteEngine on
php_value date.timezone America/Chicago

<Directory "/home/partkeepr/frontend/">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

Alias /setup "/home/partkeepr/setup"
<Directory "/home/partkeepr/setup/">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>
</VirtualHost>

Restart Apache

service httpd restart

Open browser to your server

http://yourserver/setup