Installing AMP on OpenSolaris

Hi,

I needed to install AMP on my OpenSolaris laptop to do some PHP development, and I thought some people would be interested to know how to do this.

Here we go.

AMP is available from the OpenSolaris Web Stack project, which also includes other open source components such as Perl, Ruby, Memcached, Lighthttpd, etc.

The nice thing with OpenSolaris is that - assuming my laptop is connected to the Internet - I can use the Package Manager to automatically download and install AMP on my laptop. I access the Package Manager through the menu System/Administration.

Once the Package Manager is launched, I make sure that the Repository is set to opensolaris.org and  I do a search on amp:

The amp and amp-dev packages are now listed in the selection area, the latest being a subset of the first that includes additional development tools that I do not need for my work. So I select the amp package and press the Install/Update button.

Apache is now installed in /usr/apache2, MySQL in /usr/mysql, and PHP in /usr/php5.

The runtime configuration files for Apache are located in /etc/apache2 and the default htdocs is located in /var/apache2/2.2/. The data directory where MySQL actually stores its data is located in /var/mysql/data.

The mysql group and user for MySQL and the webservd group and user for Apache exist by default in OpenSolaris. No need to create them. I can list them using the Users and Groups tool that is accessible from the OpenSolaris menu System/Administration:


No need to run the  mysql_install_db utility. MySQL can be directly populated - once started, using the mysql utility:

$ /usr/mysql/bin/mysql --user=root < createSomeData.sql

Finally, I want to register AMP in the Service Management Facility (a.k.a. SMF).  By doing so I can manage Apache and MySQL like any OpenSolaris service: if I enable them, they are automatically started during OpenSolaris boot (if I disable them, they won't be). Before starting Apache or MySQL, SMF also checks that the services required by them  - e.g. the network - are actually running.

The registration is straightforward. For Apache, I just type:

$ svccfg import /var/svc/manifest/network/http-apache22.xml
$ svcadm enable network/http:apache22

For MySQL:

$ svccfg import /var/svc/manifest/application/database/mysql.xml
$ svcadm enable application/database/mysql:version_50

I am done! 

The XML files used to register Apache and MySQL are installed automatically when downloading AMP.

Now that the services are registered I can also stop/restart Apache MySQL using the svcadm command:

$ svcadm disable/restart apache22 $ svcadm disable/restart mysql

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Application tuning, sizing, monitoring, porting on Solaris 11

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
5
6
8
9
11
12
13
14
15
16
17
18
19
20
21
22
24
25
26
27
28
29
30
   
       
Today