Search

Saturday, December 3, 2011

httpd SELinux Policy documentation

SELinux policies, especially for httpd service, is still a delicate thing for me :(
Found a good site explaining the 8 policies in FedoraProject.

We will discuss the SELinux policies someday :D

Monday, October 24, 2011

Apache PHP deployment in Ubuntu

Environment : Linux Ubuntu 11.04 Natty Narwhal

php.ini-s packaged : development and production

php.ini-development and php.ini-production, which come with the PHP 5.3 package, are really just examples of recommended settings. You should review the settings and make sure that they apply to your use and copy them to the regular php.ini file location. On my Ubuntu 10.04.1 LTS (lucid) server, here’s where I find mine:

# locate php.ini-development
/usr/share/doc/php5-common/examples/php.ini-development

The alternative example, php.ini-production, is in the same directory.

source : http://serverfault.com/questions/178270/where-is-php-ini-development-on-ubuntu-lamp

Enable mod_rewrite

what is mod_rewrite?
mod_rewrite is a part of Apache server that can rewrite requested urls on the fly.

To enable mod_rewrite in Ubuntu, you just need to write this command in terminal

sudo a2enmod rewrite

Next thing is Apache needs to be restarted
sudo service apache2 restart

source : http://mahmudahsan.wordpress.com/2008/07/06/ubuntu-enable-mod_rewrite-in-apache-server/

Install - enable mcrypt

Also on Ubuntu, make sure you actually have php5-mcrypt installed. You can install it with:

sudo apt-get install php5-mcrypt

If you get any errors, you may need to enable the 'universe' repository, explained here:
https://help.ubuntu.com/community/Repositories/Ubuntu

source : http://php.net/manual/en/mcrypt.setup.php

Unable to lock the administration directory

After execute command :
sudo apt-get install php5-mcrypt

Error message appear :
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

Answer :
As per the other answers there is a package management app holding the lock. When unsure do not manually remove the lock, first run:
sudo fuser -cuk /var/lib/dpkg/lock; sudo rm -f /var/lib/dpkg/lock

This will kill any processes opening the file before removing it.

source : http://askubuntu.com/questions/15433/fixing-could-not-get-lock-var-lib-dpkg-lock

Install PEAR


PEAR is PHP’s equivalent of Perl’s CPAN. It offers hundreds of ready-to-use code modules that can make projects go much more quickly than having to hand code everything. However, it never seems like PEAR is easy to get running.
Installing the Needed Software

In Ubuntu, installing the following packages will quickly get you started with PEAR: php5-cli, php5-dev, and php-pear.

Make sure that you read the next section about problems with using PEAR to install PEAR packages if you are running 9.10, Karmic Kaola.

Here’s an example of how to quickly install those packages from the terminal.

$ sudo apt-get install php5-cli php5-dev php-pear
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
autoconf autoconf2.13 automake automake1.4 autotools-dev libltdl-dev libssl-dev libtool m4 php5-common shtool zlib1g-dev
Suggested packages:
autobook autoconf-archive gnu-standards autoconf-doc gettext libtool-doc automaken gfortran fortran95-compiler gcj php5-suhosin
The following NEW packages will be installed:
autoconf autoconf2.13 automake automake1.4 autotools-dev libltdl-dev libssl-dev libtool m4 php-pear php5-cli php5-common php5-dev shtool zlib1g-dev
0 upgraded, 15 newly installed, 0 to remove and 5 not upgraded.
Need to get 0B/8,690kB of archives.
After this operation, 27.7MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Selecting previously deselected package m4.
(Reading database ... 127272 files and directories currently installed.)
Unpacking m4 (from .../archives/m4_1.4.13-2_i386.deb) ...
...

source : http://chrisjean.com/2009/11/02/use-php-pear-with-ubuntu/

XSL with PHP in Ubuntu


XSL support in php5 is deactivated by default. Go to Synaptic Package Manager and search for php5-xsl. Mark the package for installation, apply the changes and once it’s finished, don’t forget to restart the server!

sudo /usr/sbin/apache2 -k restart

More XSL stories later on… time to experiment :)

source : http://soledadpenades.com/2006/12/09/xsl-with-php-in-ubuntu/

Friday, July 8, 2011

Ubuntu 11.04 - 01. Installations

Create Live USB

Install to Hardisk


sources :

http://www.howtogeek.com/howto/ubuntu/installing-php5-and-apache-on-ubuntu/

Ubuntu 11.04 - 03. Virtual Servers on Apache

Edit file host

Open /etc/host . Since file hosts is owned by root-like user, we need to use sudo.

# sudo hosts

Activate virtual host configuration in apache

To configure apache webserver VirtualHost in Ubuntu server is different from other linux OS like fedora/redhat/centos. In Ubuntu apache2 have separated the virtual host into sites-available and sited-enabled directory.


source : http://www.wowtutorial.org/tutorial/24.html

Edit virtual host conf


restart apache


test

Thursday, July 7, 2011

Ubuntu 11.04 - 02. Install Apache, Mysql & PHP

objectives : installing php & apache in Ubuntu 11.04 using default repository (source)


// TODO

In terminal, use commands below :
sudo apt-get install apache2
sudo apt-get install php5
sudo apt-get install libapache2-mod-php5
sudo /etc/init.d/apache2 restart


sudo apt-get install mysql-server php5-mysql

sources :
http://www.howtogeek.com/howto/ubuntu/installing-php5-and-apache-on-ubuntu/

Wednesday, June 29, 2011

Google Application Engine (GAE) basic - Storing Data

Google Application Engine, GAE, is a web service set provided by Google. It is free for small web application - which is more than enough to start a web application.

Objective
Learn how to store data in Google Application Engine, using Java Persistence Annotation (JPA).

Storing Data in GAE
An application creates entities, with data values stored as properties of an entity. The app can perform queries over entities. All queries are pre-indexed for fast results over very large data sets.

Datastore entities are schemaless: Two entities of the same kind are not obligated to have the same properties, or use the same value types for the same properties. The application is responsible for ensuring that entities conform to a schema when needed.
The datastore provides a low-level API with simple operations on entities, including getputdelete, and query. You can use the low-level API to implement other interface adapters, or just use it directly in your applications.



source : http://code.google.com/appengine/docs/java/datastore/overview.html

Java Persistence Annotation - JPA

Java Persistence API (JPA) is a standard interface for storing objects containing data into a relational database. The standard defines interfaces for annotating Java objects, retrieving objects using queries, and interacting with a database using transactions. An application that uses the JPA interface can work with different databases without using any vendor-specific database code. JPA simplifies porting your application between different database vendors.
The App Engine Java SDK includes an implementation of JPA 1.0 for the App Engine datastore. The implementation is based on DataNucleus Access Platform. JPA presents a standard interface for interacting with relational databases, but the App Engine datastore is not a relational database. As a result, there are features of JPA that the App Engine implementation simply cannot support. We have done our best to call attention to these features wherever possible.


source : http://code.google.com/appengine/docs/java/datastore/jpa/overview.html

Starting JPA for GAE

  • Make sure JPA and Datastore JAR's available in build path, war/WEB-INF/lib/ directory.
  • Create persistence.xml file in war/WEB-INF/classes/META-INF/directory. persistence.xml is a configuration file to tell JPA to use GAE Datastore. Content of persistence.xml :
  • <?xml version="1.0" encoding="UTF-8" ?>
    <persistence xmlns="http://java.sun.com/xml/ns/persistence"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
            http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">
    
        <persistence-unit name="transactions-optional">
          <provider>org.datanucleus.store.appengine.jpa.DatastorePersistenceProvider</provider>
          <properties>
            <property name="datanucleus.NontransactionalRead" value="true"/>
            <property name="datanucleus.NontransactionalWrite" value="true"/>
            <property name="datanucleus.ConnectionURL" value="appengine"/>
          </properties>
        </persistence-unit>
    </persistence>
  • The project's build process must perform a post-compilation "enhancement" step on the compiled data classes to associate them with the JPA implementation.
Local Developement (DevAppServer)
GAE admin for development (local) server can be accessed by url http://localhost:8888/_ah/admin
This admin console can be used for managing Datastore, Task Queues, XMPP, and Inbound Mail.


source : http://code.google.com/appengine/docs/java/datastore/jpa/overview.html
http://www.vogella.de/articles/GoogleAppEngineJava/article.html

Monday, February 7, 2011

Common problems and updates on Eclipse

Common problems (and solutions if solved) and updates related to Eclipse installation and usage based on personal experience.

Environment : Linux Fedora 14. Java version "1.6.0_20".
OpenJDK Runtime Environment (IcedTea6 1.9.5)  (fedora-51.1.9.5.fc14-i386). OpenJDK Client VM (build 19.0-b09, mixed mode).
If not mentioned Eclipse Helios 3.6.1 instance is used, downloaded and installed from Fedora's default package (Add/Remove Software).

Friday, February 4, 2011

Wednesday, January 26, 2011

Install SpringsSource Tool Suite Plugin for Eclipse Galileo / Helios

Eclipse is used in my machine to develop PHP, standard Java, GAE based, and Spring framework applications. In order to keep only one instance of Eclipse, I preferred to install Springsource Tool Suite as Eclipse plugin instead of downloading whole new STS package.

Environment : Fedora Eclipse Helios default installation. Fedora 14.

Tuesday, January 25, 2011

PHP : needed yet forgettable functions and statics

PHP : needed yet forgettable functions and statics

Set Default Timezone for PHP requirement (since PHP 5.1)

Since 5.1.0 PHP encouraged to set default time zone by generating WARNING whenever function like date() used while local timezone has not been set.


Problem installing Google App Engine (AE) plugin on Eclipse Helios

When installing Google Application Engine (AE) Eclipse plugin, missing dependencies message showed :

Cannot complete the install because one or more required items could not be found.
Software being installed: Google Plugin for Eclipse 3.6 1.4.2.v201012211742
(com.google.gdt.eclipse.suite.e36.feature.feature.group 1.4.2.v201012211742)
Missing requirement: Google Eclipse 3.6 Platform Plugin 1.4.2.v201012211742 (com.google.gdt.eclipse.platform.e36 1.4.2.v201012211742) 



Environment : Fedora 14, Eclipse Helios (3.6.1) installed using GNOME Add / Remove Software.
Add Eclipse Helios Update Site

Sunday, January 23, 2011

Saturday, January 22, 2011

SELinux denies access requested by httpd (Apache)


This post is listing denied access list requested by httpd (Apache) service and ways to fix them. Solved problems :
  • Database over network access
environment : Fedora 14,built in apache installation, add with yum PHP and MySQL installation.

Friday, January 21, 2011

Common Linux Problems and Answers

Common Linux problems and answers, written as write's experience
enviroment  : Fedora 14 minimum installation. GNOME desktop environment.


Setup Multiple Virtual Hosts on Apahe, Linux Fedora 14

objective : setup virtual hosts for http://test1.local and http://test2.local
environment : Linux Fedora 14 with Apache 2.2.16 web server built in

Monday, January 17, 2011

Vi or Vim tutorials

vi / vim (Linux) Tutorial by experience, from the very basic. Vi / vim is a Linux' console text editor.

common used YUM commands

In my Fedora 14 box, most common used YUM commands :

Sunday, January 16, 2011

Problem with SELinux when changing Apache's DocumentRoot

With dual Operating System in my laptop, Fedora 14 and Windows XP, I need to set my Fedora Apache's DocumentRoot to point to windows-readable hardisk partition (NTFS). This change of path will allow me to work on same projects from both OS.
Current DocumentRoot is   /var/www/html   need to be set to   /media/Data/htDocs. For testing purpose, DocumentRoot would also be pointed to /home/user/htDocs (home directory). Problems would occurred mostly caused by SELinux policies.


Install Apache, PHP, and MySQL in Linux Fedora 14

objective : install Apache, PHP and MySQL on Fedora 14, installed from LiveUSB Fedora 14.
note : Apache already installed on Fedora 14 LiveUSB installation.

Apache, PHP, and MySQL can be installed via 2 ways :
  • XAMPP
  • YUM installation (super user)

default Eclipse in Linux Fedora 14

objective : install Eclipse, with PHP and FTP plugin, in Fedora 14 (GNOME)



WDS with Belkin G Router and TP-Link Wireless Lite N Access Point

WDS, stands form Wireless Distributed System, is a way to extend / expand wireless network coverage. Not every wireless router / access point has this feature.
read : WDS in wikipedia

Objective : expand wireless network coverage served by Belkin G Router. Belkin G Router, will act as Root AP, doesn't have WDS feature.