Saturday, January 5, 2013

Installing Symfony2 on Centos 6

Symfony2 framework looks like it provide many useful development tools.

All following codes require access to internet to download the respective files.

Pre installation check list for Symfony2.1.

  1. Installed and running Apache httpd
  2. Installed php 5.3 or higher
  3. Installed GIT 1.7 or higher
Install PHP
Lots of resources available online.

Ensure additional php packages are installed, including
  • php-cli
  • php-intl
  • php-mysql (if you use MySQL database)
  • php-gd
  • php-pecl-apc
  • php-mbstring

Check that /etc/php/ini timezone is edited.
Example;
date.timezone = "Asia/Kuala_Lumpur"

Install GIT
sudo yum install git-core

Install Composer for PHP
cd /var/www/html
curl -s https://getcomposer.org/installer | php


Install Symfony2.1
Step 1: Download from http://symfony.com/download and extract


tar xvzf Symfony_Standard_Vendors_2.1.6.tgz

Read the text file Symfony/README.md

cp composer.phar Symfony

Step 2: Basic configuration



Step 3: Create your first Symfony2 project

cd /var/www/html/Symfony
php composer.phar create-project symfony/framework-standard-edition /var/www/html/mysymfony 2.1.6

Where
  • create-project is the command to create a project with 3 arguments
  • symfony/framework-standard-edition is the framework to be installed
  • /var/www/html/mysymfony is the new directory or project name to be created and installed with base project files
  • 2.1.6 is the version
Use a web browser to check installed project at

http://localhost/mysymfony/web/config.php

If there is an error, please fix before continuing. I received 2 errors to fix the directory permission for app/cache and app/logs

chown -Rf apache.apache app/logs app/cache


Note: I found following discussion useful

http://forum.symfony-project.org/viewtopic.php?f=32&t=45892

What you should not do for your online portal

At any time if you have launched a portal accessed publicly, its a bad idea to have links showing Minta Maaf.

Just found this on the Malaysian Road Transport Department Portal on  5 Jan 2013.

If its not ready, no need to put it online, right? Just my Opinion.




The link kept directing to http://www.jpj.gov.my/mintamaaf for most of the options I picked.





Friday, December 28, 2012

Statistics on OSS

From time to time, the use of OSS needs justification. What better then information based on open source development model. This includes;


  1. Large number of contributors
  2. Frequency of updates (commits)
  3. Lines of codes
I found such info from Ohloh.net. Example for HTTP Server from Apache is at http://www.ohloh.net/p/apache




Saturday, December 15, 2012

Upgrade Sony Tablet S to Android 4.0.3 rel5

Just received notice of an upgrade. Current Android is 4.0.3 rel 1.

Info on updates is at http://www.sony-asia.com/support/faq/528949

Thursday, December 6, 2012

Speedtest via Digi

Speedtest.net results for Digi on SE Xperia X10i with Android 2.3.3

Subscribed to Digi unlimited
[1st round] on 6 Dec 2012
Download: 558kbps, Upload: 377kbps
Ping 99ms

[2nd round] on 6 Dec 2012

Download: 1658kbps, Upload: 372kbps
Ping 90ms


Hmmm...

Tuesday, December 4, 2012

Centos Linux and 7z

Files with the extension of .7z indicates its a 7-zip compressed files in unicode format. To access files within the 7z, you will need to uncompress or extract the 7z file. By default, compression uses LZMA or Lempel–Ziv–Markov chain algorithm, which is an algorithm used to perform lossless data compression.

The program used to access 7z files;

  1. Windows: 7-zip
  2. Centos Linux: p7zip

Main differences of 7z and tar, is that 7z is meant to be more portable. This includes dropping of the user/group permission of files. I will demonstrate based on Centos 6.

A. Creating a 7z file
Step 1: Installing p7zip
yum install p7zip

Step 2: Compress files in directory named "examples" into the file myfiles.7z
7za a myfiles.7z

Step 3: List files within myfiles.7z
7za l myfiles.7z

Example output as below (note - no user/group info)

7-Zip (A) [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
p7zip Version 9.20 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,4 CPUs)

Listing archive: scripts.7z

--
Path = scripts.7z
Type = 7z
Method = LZMA
Solid = +
Blocks = 1
Physical Size = 4319
Headers Size = 365

   Date      Time    Attr         Size   Compressed  Name
------------------- ----- ------------ ------------  ------------------------
2012-12-04 09:17:15 ....A          179         3954  examples/svn-auth-users
2012-12-04 09:17:15 ....A           35               examples/tboxmy.sh
2012-12-04 09:17:15 ....A         1004               examples/menusnapshot.sh
2012-12-04 09:17:15 D....            0            0  examples 
------------------- ----- ------------ ------------  ------------------------
                                  1218         3954  3 files, 1 folders


Optional steps;
Verify 7z file
7za t myfiles.7z


B. Extracting a 7z file

Step 1: Extract to current directory
7za e myfiles.7z


Saturday, November 24, 2012

Contributing to Libreoffice

well, Patching of Libreoffice is a commitment from a wide range of users. Below is a response of a contributor on how he contributes. =======
When I work, I frist create a branch out of a point in master (preferably a oen that build nicely :-) ) so nwo I'm on branch 'foo' for example. I code my patch, then I submity it to gerrit via git push origin foo:refs/for/master then I checkout out master again... and keep going... When the review comes and modification to my patch are needed, I checkout out the branch foo again... the I make the modifications and 'amend' the commit (which _is_ the commit I pushed to gerrit) and then push it again using the same command. rince and repeat until the patch is ready... then I let gerrit cherry pick it on top of master.. if ok, then I can delete the foo branch locally if the cherry pick failed because of a conflict... I fetch ./g fetch and then rebase foo : git rebase origin/master (while being on the foo branch) since the cherry pick from gerrit failed, that rebase should exibit some conflict, with I resolve using git mergetool then one can re-push the patch to gerrit, again using the same command as above.. rince and repeat until the cherry pick from gerrit works If one has commit right, then the last phase can be dealt by bringing the patch to master locally and simply pushing to master

Thursday, November 22, 2012

Change MySQL database directory

Why do I need to change MySQL database directory or location?

  1. Current disk is out of space
  2. Current partition is out of space
  3. There is a better filesystem to improve disk IO performance.
Steps to do this on Centos 6 with SELinux enforced.

Step 1: Stop MySQL server

Step 2: Create the new directory

A new directory can be created in the new disk or partition.

Step 3: Copy existing database to new location
 mv /var/lib/mysql/* /srv/mysql/

Step 4: Configure MySQL server
Edit /etc/my.cnf with following

datadir=
socket=

[client]
socket=

Save and close the file.

5. Configure SELinux to allow new database
View current settings

setstatus
ls -lZ /var/lib/mysql
ls -lZ

Edit settings with e.g. as /media/server/mysql

semanage fcontext -a -t mysqld_db_t "/media/server/mysql(/.*)?"
OR
chcon -R -t mysqld_db_t /media/server/mysql

restorecon -Rv /media/server/mysql

Check settings are in the config file

grep -i mysql /etc/selinux/targeted/contexts/files/file_contexts.local

6. Start up MySQL
I had to reboot the server and change selinux to permissive for all this to work.

Wednesday, November 21, 2012

Linux welcome messages

Securing the Linux terminal includes telling users that they may not access the system without authorisation.

Edit following files for this purpose;

  1. /etc/motd
  2. /etc/issue
  3. /etc/issue.net

For items 2 and 3, they only work if you are connected at the terminal or have client server setup. Those using SSH, messages can be set to point to item 3 in the configuration file /etc/ssh/sshd_config


Sunday, November 18, 2012

Howto Yii 1, a PHP framework

This framework seemed worth while to test out. Steps to get started is as follows;

Step 1: Install the framework.
From the www.yiiframework.com site, follow the instructions for pre-requisite to install the Yii framework. Typically you will need

  1. Apache web browser
  2. PHP 5.1 and newer
  3. PHP PDO
  4. A database


Download Yii-1.1...tar.gz (in tar.gz format) from http://www.yiiframework.com/download/
Extract the tar.gz file to the web folder /var/www/html/yii1

It is also a good point to download the Yii-docs-1.1...tar.gz and extract it to follow its references and tutorials in PDF.

Step 2: Create the skeleton of a new web app.
At the prompt, access the framework's directory /var/www/html/yii1/framework

Type the following:
./yiic webapp ../testdrive

or in windows
yiic webapp ..\testdrive

Open a web browser and access the testdrive application
http://localhost/yii1/testdrive

Step 3: Configure the timezone for the web app.
If an error on the timezone appears, complete following steps

vi /var/www/html/yii1/testdrive/protected/config/main.php

Just before the last line, add the timezone.


'timeZone'=>'Asia/Kuala_Lumpur',
);

Access the testdrive application with the web browser, the error on timezone is gone. It does inform users the following;


You may change the content of this page by modifying the following two files:

View file: C:\Program Files\www\yii1\testdrive\protected\views\site\index.php
Layout file: C:\Program Files\www\yii1\testdrive\protected\views\layouts\main.php



Step 4. Understanding the structure
It is good to know the directories built for the testdrive web application under /var/www/html/yii1/testdrive. From here on, I will refer to the directory /var/www/html/yii1/testdrive as

/index.php
/index-test.php
/assets/  <=Empty
/css/  <=Contains 5 basic CSS files and a bg.gif file
/images/  <=Empty
/protected/  <=This is where your coding goes
/themes/  <=Several directories that is empty

Step 5. The database, mysql
Create a database named yii_testdrive, and load in the SQL from
/protected/data/schema.mysql.sql

By default it has the SQLLITE as its database, edit the file /config/main.php and comment out the following lines


'db'=>array(
'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',
),

Uncomment the mysql lines below it and edit the database connection


'db'=>array(
'connectionString' => 'mysql:host=localhost;dbname=yii_testdrive',
'emulatePrepare' => true,
'username' => 'root',
'password' => '',
'charset' => 'utf8',
),



Step 6. Generating the pages based on the database

Uncomment the GII web-based code generator and change the default password to MyPassword


'gii'=>array(
'class'=>'system.gii.GiiModule',
'password'=>'MyPassword',
// If removed, Gii defaults to localhost only. Edit carefully to taste.
'ipFilters'=>array('127.0.0.1','::1'),
),



Open a web browser and point to the gii resource
 http://localhost/yii1/testdrive/index.php?r=gii

A login page appears, type the password as
MyPassword

You are then presented with the following to auto generate codes based on your database.


  1. Controller Generator
  2. Crud Generator
  3. Form Generator
  4. Model Generator
  5. Module Generator



Thats all for now...will continue when time permits.

Saturday, September 29, 2012

Howto Install OpenSIS on Centos 6


Step 1: Retrieve the package
Download from http://sourceforge.net/projects/opensis-ce/files/latest/download
Extract opensis-ce to /vcar/www/html

Step 2: Launch web installer
Start mysqld and httpd (apache web server). Open a web browser and point to the address

http:///opensis-ce/install

Follow onscreen instructions to install database and sample database.

Friday, September 14, 2012

Installing Plone 4 on Centos 6

Plone 4 is based on Python and Zope and provides its own little database.

Installation on Centos 6.3 was pretty straight forward in the standalone mode. Alternative, mode is as ZEO Cluster or a single running instance.

Step 1: Download the Unified installer (comes with Python and Zope) for Plone.

Download from Plone.org (https://launchpad.net/plone/4.2/4.2.1/+download/Plone-4.2.1-UnifiedInstaller.tgz) with a file size of approx 50MB.

See http://plone.org/products/plone/releases/4.2.1

Step 2: Install dependency files.
Most of these are already installed if Centos was installed with the development tools.
Add the RPMForge repo;

wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
rpm -ivh rpmforge-release-0.5.2-2.el6.rf.i686.rpm

yum install gcc gcc-g++ make tar bzip2 gzip
yum install readline libgsf
yum install wv

If there is problem with the wv package, download wv from EPEL or http://wvware.sourceforge.net and install with RPM.

rpm -ivh wv-1.2.7-2.el6.i686.rpm


Step 3: Extract & Install Plone
Enter the directory with the UnifiedInstaller (Download directory).

tar zxvf Plone-4.2.1-UnifiedInstaller.tar.gz
cd plone-4.2.1
./install.sh standalone
cd /usr/local/Plone/zinstance

Identify which port (default 8080) will be used for Plone. If needed, change the port then apply changes by typing

bin/buildout

Step 4: Start/Stop Plone
The Plone server can be started or stop with following command (replace the word start)

/usr/local/Plone/zinstance/bin/plonectl start

Step 5: Access Plone
Open a web browser (e.g. Firefox, Chrome) and enter following URL address;

http://localhost:8080

Default password is found in the file /usr/local/Plone/zinstance/adminPassword.txt

Create a Plone instance, then read the instructions at the main page of the Plone instance.

Additional notes:
Install following packages;

  • Openoffice.org or libreoffice (headless) for better document conversion
  • msttcorefonts for better formatting compatibility, see previous post


References: http://plone.org/documentation/manual/installing-plone/installing-on-linux-unix-bsd/referencemanual-all-pages

Wednesday, September 12, 2012

PostgreSQL 9.2 improves

Latest PostgreSQL will support 64 cores, or 3x its current capability. Transactions per second increased to about 350,000 is over 4x its current speed.

Not bad for OPEN SOURCE!

see
http://www.databasejournal.com/features/postgresql/postgresql-9-2-open-source-database.html

Tuesday, September 4, 2012

Howto install Alfresco 4, the Community edition on Centos 6

Alfresco provides some very interesting functions. This includes support for networking with CIFS, WebDav and IMAP.

See https://www.alfresco.com/products/platform

Check following have been done.
  1. Linux must be 64bit. Why? they only provided Alfresco for Linux on 64 bits, thats why.
  2. Install LibreOffice (yum install libreoffice libreoffice-headless), version 3.4.5.2 was installed
  3. Install MySQL (yum install mysql-server), in my case version 5.1.61 was installed.


Following are steps that I have taken to install Alfresco 4 on Centos 6.

Step 1. Create the database
At the CLI, login to MySQL and create database named "alfresco"

# mysql -u root -p
CREATE DATABASE alfresco;
\q

Step 2. Start LibreOffice as headless

soffice "-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager" \
 -nologo -headless



Step 3. Get the software and install

Download from http://wiki.alfresco.com/wiki/Download_and_Install_Alfresco
Double click on the file alfresco-community....bin and follow the onscreen instructions.

I choose the "Easy" method, and included the "Share"

Alternatively, installation can be done at the Linux CLI, just switch to root user, go to the directory where the file was downloaded and type
# ./alfresco-community-4.0.x-installer-linux-x64.bin ---mode text

Step 4. Start Alfresco, based on the Tomcat server port of 8080.
Alfresco started automatically, but is needed, got the the /opt/alfresco folder and type
alfresco.sh start

Access the application with a web browser and the following URLs/

http://localhost:8080/alfresco
and http://localhost:8080/share

Wednesday, August 22, 2012

Howto add menu to Gnome

Centos 6.3 defaults with the Gnome desktop. After installing / creating a custom application, how do you add it to the start menu?

Answer: Install alacarte

Step 1: Install Alacarte

# yum install alacarte

Step 2: Add the new program as a menu item.

Click System ->Preferences ->Main Menu
Choose the menu and add the new item.




Tuesday, August 21, 2012

Kubuntu - USB disk does not mount

Followup from the Kubuntu 10.04 installation, for those who have opted to stay on with Kubuntu 10.04, mounting of USB disk is done manually or alternatively, install usbmount.

Using the Package Manager or at the command line, install the following packages

  1. usbmount
  2. pmount
Additionally, if you have NTFS (windows default file system, install the following package
  1. ntfs-3g
Logout, then log back in and plug-in the USB disk (or thumb drive). Dolphin should pop up saying it detected the disk. The USB disk are mounted by default in the /media folder with the name of the partition.



Tuesday, August 14, 2012

Stop 114a

See http://en.wikipedia.org/wiki/Malaysia_Internet_Blackout_Day_%282012%29


Direct Apache access to SSL ports

Secure Socket Layer (SSL) provides an encrypted network connection and is seen to use the HTTPS protocol in the URL. To ensure that the web server only servers HTTPS, the following needs to be enabled before the HTTPS VirtualHost tag.



RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}:443%{REQUEST_URI}


What it means? turn off https if its https, then change the url to always use https.

Actually, you can put a lot more between the VirtualHost tag. E.g. choice of error pages to server and limiting which domain/IP address that can access the contents.

Thursday, August 2, 2012

Screen capture your Android phone

On the Xperia X10i with Android 2.3, and most other Android phones, you can screen capture for purpose of troubleshooting, development, presentation and article writing. Here is listed the instructions on MS Windows 7.

Step 1: Install the Android SDK.

Step 2: Switch the X10i debug.
Click "left" button, choose "Settings" ->"Applications" ->"Development".

Click to Check "USB Debugging".

Step 3: Plug USB cable between X10i and PC.
If asked to charge, choose that option.

Step 4: On the PC, start the Dalvik Debug Monitor (DDMS)
Click the Windows "Start" button, and type following and press "Enter" key.

cmd

Switch to the android directory and type following and press "Enter" key.

tools\ddms.bat

Ensure that you choose your phone from the left list. In my case its written as "XXX [SonyEricsson:X10i]". From the top menu of DDMS, click "Device" ->"Screen capture..."

Step 5: Capture the screen on the Android device (X10i)


On the X10i, select the screen to be captured (or saved).

Then on the PC, the DDMS should show the same screen as the Android, click "Copy". Start the graphics software such as GIMP or MS Paint and "paste" the screen capture. Save as the filename of your choice.

I have not used the "Save" button on DDMS, so I can't say where it saves to.






Wednesday, August 1, 2012

Bacula on Suse Linux

Anyone tried to install Bacula on Suse?
I started the search from the following site;

http://adrian.onsen.ca/2011/10/bacula-and-webmin-setup/

List of repos that can be used for the installation.


Bacula ver 5.2.1 + Suse 11

Bacula ver 5.2.1 +Suse 11&12


Webmin also list support as shown in http://www.webmin.com/cgi-bin/search_third.cgi?modules=1
Bacula Backup System 1.590
DescriptionConfigure Bacula to perform backups and restores manually or on schedule, for one or many systems
Downloadbacula-backup.wbm.gz
Websitehttp://www.webmin.com/webmin/standard.html
AuthorJamie Cameron
Last updated2012-07-01 05:49:18


Will need to try again another day.

Blog Archive