Install Apache, MySQL And PHP On OpenBSD 5.4

by
Share this Article: Facebook0Google+0Twitter12LinkedIn1Reddit0StumbleUpon1

I have tested OpenBSD last few days in Virtualbox and give you all what you need like development or programming tools/hosting/clustering and many more options.

My First test is installing OAMP (Openbsd, Apache, Mysql and php), please follow the steps below to make it ready.

The installation from internet is not standard activated in OpenBSD. Please choose your mirror do it on this way.

export PKG_PATH=http://ftp.bit.nl/pub/OpenBSD/5.4/packages/`machine -a`/

 Install Apache

# pkg_add  -u apache-httpd
 Can't find apache-httpd
 Problem finding apache-httpd
 # pkg_add  -i  apache-httpd
 apache-httpd-2.2.25:pcre-8.33: ok
 apache-httpd-2.2.25:apr-1.4.6p1: ok
 apache-httpd-2.2.25:db-4.6.21p0v0: ok
 apache-httpd-2.2.25:apr-util-1.4.1p2: ok
 apache-httpd-2.2.25: ok
 The following new rcscripts were installed: /etc/rc.d/httpd2
 See rc.d(8) for details.
 --- +apache-httpd-2.2.25 -------------------
 This is the official httpd distributed by the Apache Server Project,
 provided as a port for those who, for various reasons, need to run
 version 2.
OpenBSD provides a custom Apache server, httpd(8), in the base system
 which has been audited for security and may run in a chroot(2)
 environment.  Users are STRONGLY encouraged to use the system httpd
 rather than this port.

Install php-mysql

# pkg_add  php-mysql
Ambiguous: choose package for php-mysql
 a       0: <None>
         1: php-mysql-5.2.17p16
         2: php-mysql-5.3.27
Your choice: 2
Ambiguous: choose dependency for php-mysql-5.3.27:
 a       0: php-5.3.27
         1: php-5.3.27-ap2
Your choice: 1
php-mysql-5.3.27:mysql-client-5.1.70v0: ok
php-mysql-5.3.27:libxml-2.9.0p0: ok
php-mysql-5.3.27:femail-0.98: ok
php-mysql-5.3.27:femail-chroot-0.98p2: ok
php-mysql-5.3.27:php-5.3.27-ap2: ok
php-mysql-5.3.27: ok
Look in /usr/local/share/doc/pkg-readmes for extra documentation.
--- +php-5.3.27-ap2 -------------------
To enable the php-5.3 module please create a symbolic link from
/var/www/conf/modules.sample/php-5.3.conf to
/var/www/conf/modules/php.conf. As root:

    ln -sf /var/www/conf/modules.sample/php-5.3.conf /var/www/conf/modules/php.conf

The recommended php configuration has been installed to:
    /etc/php-5.3.ini.
--- +php-mysql-5.3.27 -------------------
You can enable this module by creating a symbolic link from
/etc/php-5.3.sample/mysql.ini to
/etc/php-5.3/mysql.ini. As root:

    ln -sf /etc/php-5.3.sample/mysql.ini /etc/php-5.3/mysql.ini
#

Install MySQL-server 

# pkg_add mysql-server
mysql-server-5.1.70v0:p5-Net-Daemon-0.48: ok
mysql-server-5.1.70v0:p5-PlRPC-0.2018p1: ok
mysql-server-5.1.70v0:p5-FreezeThaw-0.5001: ok
mysql-server-5.1.70v0:p5-MLDBM-2.05: ok
mysql-server-5.1.70v0:p5-Params-Util-1.07: ok
mysql-server-5.1.70v0:p5-Clone-0.34: ok
mysql-server-5.1.70v0:p5-SQL-Statement-1.33: ok
mysql-server-5.1.70v0:p5-DBI-1.622: ok
mysql-server-5.1.70v0:p5-DBD-mysql-4.023p0: ok
mysql-server-5.1.70v0: ok
The following new rcscripts were installed: /etc/rc.d/mysqld
See rc.d(8) for details.
Look in /usr/local/share/doc/pkg-readmes for extra documentation.

 SET Mysql root password

# mysql_install_db
# /usr/local/share/mysql/mysql.server start
Starting MySQL
.. SUCCESS!
# /usr/local/bin/mysqladmin -u root password "password"

 Check mysql login:

# mysql  -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.70-log OpenBSD port: mysql-server-5.1.70v0

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show   databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| test               |
+--------------------+
3 rows in set (0.00 sec)

mysql>

 

 Install phpMyadmin

# pkg_add phpMyAdmin
phpMyAdmin-4.0.4.1:libmcrypt-2.5.8p1: ok
phpMyAdmin-4.0.4.1:libltdl-2.4.2: ok
phpMyAdmin-4.0.4.1:php-mcrypt-5.3.27: ok
phpMyAdmin-4.0.4.1:php-mysqli-5.3.27: ok
phpMyAdmin-4.0.4.1:png-1.6.2p0: ok
phpMyAdmin-4.0.4.1:t1lib-5.1.2: ok
phpMyAdmin-4.0.4.1:jpeg-9p0: ok
phpMyAdmin-4.0.4.1:php-gd-5.3.27: ok
phpMyAdmin-4.0.4.1: ok
--- +php-gd-5.3.27 -------------------
You can enable this module by creating a symbolic link from
/etc/php-5.3.sample/gd.ini to
/etc/php-5.3/gd.ini. As root:

    ln -sf /etc/php-5.3.sample/gd.ini /etc/php-5.3/gd.ini
--- +php-mcrypt-5.3.27 -------------------
You can enable this module by creating a symbolic link from
/etc/php-5.3.sample/mcrypt.ini to
/etc/php-5.3/mcrypt.ini. As root:

    ln -sf /etc/php-5.3.sample/mcrypt.ini /etc/php-5.3/mcrypt.ini
--- +php-mysqli-5.3.27 -------------------
You can enable this module by creating a symbolic link from
/etc/php-5.3.sample/mysqli.ini to
/etc/php-5.3/mysqli.ini. As root:

    ln -sf /etc/php-5.3.sample/mysqli.ini /etc/php-5.3/mysqli.ini
#

don’t forget this please:

cp  /var/www/conf/modules.sample/phpmyadmin.conf  /var/www/conf/modules/

in the phpmyadmin.conf, Please edit to Allow from all

Enable index.php

If you want  to add “index.php”  to /var/www/conf/httpd.conf

Find to the DirectoryIndex and add index.php

DirectoryIndex index.php index.html

Start Mysql and apache at boot.

add this to /etc/rc.conf,

mysqld_flags=""
httpd_flags=""
pkg_scripts="mysqld"

Please deactivate or configure the firewall to allow needed ports.

/etc/rc.conf" ### edit the boot time configuration file.

pf_enable="YES" ### turn PF on when the computer boots.                         
pf_rules="/etc/pf.conf" ### define the rules for the firewall.
pf_flags="" ### additional flags (none).
pflog_enable="YES" ### turn on packet logging support.
pflog_logfile="/var/log/pflog" ### where to log data to, used with pflogd daemon.
pflog_flags="" ### additional flags (none).

Lets start testing:

 

bsd1 bsd2 bsd3 psd4

 

For questions please refer to our Q/A forum at : http://ask.unixmen.com/


Share this Article: Facebook0Google+0Twitter12LinkedIn1Reddit0StumbleUpon1