How to install latest WordPress on FreeBSD 10 : enable web server

In my last post I decide to investigate how to install wordpress on FreeBSD 10 (latest version of FreeBSD at the moment). I use two methods of installation; first using ports and second using pkg. After try it myself I prefer to use pkg for future deployment for following reason :

  1. Fast installation; you don’t have to wait for hours as you did with ports.
  2. More secure; you have binary package. No need for compiler stuff installed in my server.

Of course ports can supply you with so many different options with its dialog but as Michael W Lucas said, he prefer to do other job that pay his bills than watch compile process. Me too :-)

Ok, back to wordpress. Last install is not complete one as I don’t see web server and database.

pkg info result

# pkg info

ca_root_nss-3.17.1             The root certificate bundle from the Mozilla Project
curl-7.38.0_2                  Non-interactive tool to get files from FTP, GOPHER, HTTP(S) servers
freetype2-2.5.3_2              Free and portable TrueType font rendering engine
jpeg-8_5                       IJG’s jpeg compression utilities
kbproto-1.0.6                  KB extension headers
libICE-1.0.9,1                 Inter Client Exchange library for X11
libSM-1.2.2_2,1                Session Management library for X11
libX11-1.6.2_2,1               X11 library
libXau-1.0.8_2                 Authentication Protocol library for X11
libXaw-1.0.12_2,2              X Athena Widgets library
libXdmcp-1.1.1_2               X Display Manager Control Protocol library
libXext-1.3.2_2,1              X11 Extension library
libXmu-1.1.2_2,1               X Miscellaneous Utilities libraries
libXp-1.0.2_2,1                X print library
libXpm-3.5.11_2                X Pixmap library
libXt-1.1.4_2,1                X Toolkit library
libpthread-stubs-0.3_6         This library provides weak aliases for pthread functions
libxcb-1.10_2                  The X protocol C-language Binding (XCB) library
libxml2-2.9.1_1                XML parser library for GNOME
pcre-8.35_1                    Perl Compatible Regular Expressions library
php5-5.4.33_1                  PHP Scripting Language
php5-curl-5.4.33_1             The curl shared extension for php
php5-gd-5.4.33_1               The gd shared extension for php
php5-mysql-5.4.33_1            The mysql shared extension for php
php5-tokenizer-5.4.33_1        The tokenizer shared extension for php
php5-xml-5.4.33_1              The xml shared extension for php
php5-zip-5.4.33_1              The zip shared extension for php
pkg-1.3.8_3                    Package manager
png-1.5.18                     Library for manipulating PNG images
printproto-1.0.5               Print extension headers
t1lib-5.1.2_4,1                Type 1 font rasterization library for Unix/X11
wordpress-4.0,1                State-of-the-art semantic personal publishing platform
xextproto-7.3.0                XExt extension headers
xproto-7.0.26                  X11 protocol headers

Lets continue : Continue reading

How to install WordPress on FreeBSD 10

As one of the famous content management system WordPress is one my favourite since 2007 (this blog use serendipity , blogspot custom domain then change to wordpress) and stick to it till now. For me this software is simple to use and I can handle the maintenance.

This time I’ll show how to install wordpress on FreeBSD 10 using two methods : ports and pkg way.

For this purpose I use FreeBSD 10 provided by vultr. I use 768 MB VPS located on New Jersey.

Update FreeBSD

# freebsd-update fetch

# freebsd-update install

# uname -a

FreeBSD wordpress.rasyid.net 10.0-RELEASE-p9 FreeBSD 10.0-RELEASE-p9 #0: Mon Sep 15 14:35:52 UTC 2014     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64

Continue reading

FreeBSD Old ISO

I just knew if FreeBSD 10 use Clang by default last time I try to compile HHVM on FreeBSD 10. Since I know nothing about this stuff I prefer to look back for older version when necessary. Quite surprise for me that FreeBSD have their collection since version 1.

I only have 32 machine so I rather stay with it and love this folder. Due to vps provider policy I slowly move to 64 bit to make sure everything went fine. So 64 bit version of old FreeBSD also in my list.

For long time ago I use provider such rootbsd for testing experiment purpose but now I have much easier way to accomplish my hobby. Vultr provide me access to that old version even only for 64 bit architecture.

I can go back to see how FreeBSD looks like when version 5.1 released or step back to 9.2 to implement pkg.

What a beautiful world :-)

Compile HHVM 3.3 on FreeBSD 10

Since HHVM support wordpress I wanna try it on FreeBSD but compile guide for source only available for FreeBSD 8 and downgrade FreeBSD is not an option. Since I have access to vps that capable to run FreeBSD 10 64 bit I decide to take a ride and see how far (hhvm 3.3) and I can go. At least when I have to re-run the test I can see where I fall :-)

Update hostname

#ee /etc/rc.conf

# Auto-Enabled NICs from pc-sysinstall

ifconfig_vtnet0=”inet 104.156.250.192 netmask 255.255.254.0″
defaultrouter=”104.156.250.1″
hostname=”hhvm330.rasyid.net”
sshd_enable=YES
static_routes=linklocal
route_linklocal=”-net 169.254.0.0/16 -interface vtnet0″

save.

# mkdir -p /usr/src/lib/libc/gen

# freebsd-update fetch
# freebsd-update install

update pkg

# pkg update
The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]: y
Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/freebsd:10:x86:64/latest, please wait…
Verifying signature with trusted certificate pkg.freebsd.org.2013102301… done
Installing pkg-1.3.8_3: 100%
Message for pkg-1.3.8_3:
If you are upgrading from the old package format, first run:

# pkg2ng
Updating FreeBSD repository catalogue…
Fetching meta.txz: 100%   944 B   0.9k/s    00:01
Fetching digests.txz: 100%    2 MB   2.1M/s    00:01
Fetching packagesite.txz: 100%    5 MB   5.3M/s    00:01
Processing new repository entries: 100%
FreeBSD repository update completed. 23551 packages processed:
0 updated, 0 removed and 23551 added.

# echo '104.156.250.192    hhvm330.rasyid.net ' >> /etc/hosts

#reboot

# uname -a
FreeBSD hhvm330.rasyid.net 10.0-RELEASE-p9 FreeBSD 10.0-RELEASE-p9 #0: Mon Sep 15 14:35:52 UTC 2014     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64

Ok, lets get started.

Install devel package :

# pkg install git cmake flex bison re2c openssl libxml2 libxslt openldap-client pcre oniguruma boost-libs libmemcached libmcrypt binutils expat mysql56-client wget tbb icu libexecinfo gcc48 gawk git cclient mc autoconf gmake libevent-hiphop sqlite3 lz4 libzip libedit libinotify glog libelf libdwarf unixodbc  gnulibiberty libyaml  jpeg

Add Jemalloc Support

# mkdir -p /usr/src/contrib
# cd /usr/src/contrib/

# git clone https://github.com/jemalloc/jemalloc.git --depth=1
Cloning into ‘jemalloc’…
remote: Counting objects: 181, done.
remote: Compressing objects: 100% (162/162), done.
remote: Total 181 (delta 18), reused 80 (delta 14)
Receiving objects: 100% (181/181), 372.00 KiB | 0 bytes/s, done.
Resolving deltas: 100% (18/18), done.
Checking connectivity… done.
.

Fix for CClient 2007

#cd /usr/local/lib
#ln -s libc-client4.so libc-client.so

Create a directory for build

# mkdir ~/hhvm330
# cd ~/hhvm330/
# mkdir libs

Get latest HHVM code

# git clone git://github.com/facebook/hhvm.git --depth=1
Cloning into ‘hhvm’…
remote: Counting objects: 40962, done.
remote: Compressing objects: 100% (31200/31200), done.
remote: Total 40962 (delta 6408), reused 29798 (delta 5604)
Receiving objects: 100% (40962/40962), 21.38 MiB | 10.27 MiB/s, done.
Resolving deltas: 100% (6408/6408), done.
Checking connectivity… done.
Checking out files: 100% (53350/53350), done.

#cd hhvm

# git submodule update --init --recursive
Submodule ‘third-party’ (https://github.com/hhvm/hhvm-third-party.git) registered for path ‘third-party’
Cloning into ‘third-party’…
remote: Counting objects: 2248, done.
remote: Total 2248 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (2248/2248), 6.66 MiB | 0 bytes/s, done.
Resolving deltas: 100% (1118/1118), done.
Checking connectivity… done.
Submodule path ‘third-party’: checked out ’12acbba4c05d8cbe97fe2a94a4a833c0c80e8182′
Submodule ‘folly’ (https://github.com/facebook/folly.git) registered for path ‘folly/src’
Submodule ‘thrift/src’ (https://github.com/facebook/fbthrift.git) registered for path ‘thrift/src’
Cloning into ‘folly/src’…
remote: Counting objects: 7548, done.
remote: Total 7548 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (7548/7548), 3.41 MiB | 0 bytes/s, done.
Resolving deltas: 100% (5746/5746), done.
Checking connectivity… done.
Submodule path ‘third-party/folly/src’: checked out ‘4ecd8cdd6396f2f4cbfc17c1063537884e3cd6b9’
Cloning into ‘thrift/src’…
remote: Counting objects: 8752, done.
remote: Total 8752 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (8752/8752), 4.99 MiB | 0 bytes/s, done.
Resolving deltas: 100% (6319/6319), done.
Checking connectivity… done.
Submodule path ‘third-party/thrift/src’: checked out ‘378e954ac82a00ba056e6fccd5e1fa3e76803cc8’

Configure environment for GCC 4.8

#setenv CC /usr/local/bin/gcc48
#setenv CXX /usr/local/bin/g++48
#setenv CMAKE_PREFIX_PATH `pwd`/../libs

Libmap

#ee /etc/libmap.conf

[hhvm]
libstdc++.so.6 gcc48/libstdc++.so.6

[program]
libstdc++.so.6 gcc48/libstdc++.so.6

save.

Create hhvm binary.

#cd hhvm
#cmake .

…..
…………..
CMake Warning (dev) at CMake/HPHPFunctions.cmake:156 (get_target_property):
Policy CMP0026 is not set: Disallow use of the LOCATION target property.
Run “cmake –help-policy CMP0026” for policy details.  Use the cmake_policy
command to set the policy and suppress this warning.

The LOCATION property should not be read from target “hhvm”.  Use the
target name directly with add_custom_command, or use the generator
expression $<TARGET_FILE>, as appropriate.

Call Stack (most recent call first):
hphp/hhvm/CMakeLists.txt:45 (HHVM_INSTALL)
This warning is for project developers.  Use -Wno-dev to suppress it.

— Configuring done
— Generating done
— Build files have been written to: /root/hhvm330/hhvm

#make

/root/hhvm330/hhvm/third-party/folly/folly/Conv.cpp:89:7: note: in expansion of macro ‘FOLLY_RANGE_CHECK’
FOLLY_RANGE_CHECK(value <= 1,
^
/root/hhvm330/hhvm/third-party/folly/folly/Conv.h:47:21: error: ‘to_string’ is not a member of ‘std’
(__FILE__ “(” + std::to_string((long long int) __LINE__) + “): ”    \
^
/root/hhvm330/hhvm/third-party/folly/folly/Conv.cpp:130:9: note: in expansion of macro ‘FOLLY_RANGE_CHECK’
FOLLY_RANGE_CHECK(false, “Invalid value for bool”);
^
/root/hhvm330/hhvm/third-party/folly/folly/Conv.h:47:21: error: ‘to_string’ is not a member of ‘std’
(__FILE__ “(” + std::to_string((long long int) __LINE__) + “): ”    \
^
/root/hhvm330/hhvm/third-party/folly/folly/Conv.cpp:134:7: note: in expansion of macro ‘FOLLY_RANGE_CHECK’
FOLLY_RANGE_CHECK(false, “Invalid value for bool”);
^
*** Error code 1

Stop.
make[2]: stopped in /root/hhvm330/hhvm
*** Error code 1

Stop.
make[1]: stopped in /root/hhvm330/hhvm
*** Error code 1

Stop.
make: stopped in /root/hhvm330/hhvm

Fiuh… I guess I need a break and wait for another release :-)

Startup memory difference Percona Server vs MariaDB

When browsing for FreeBSD ports on database section I stumbleupon percona server and decide to see whats the difference between pkg and ports :

update pkg

# pkg update
Updating FreeBSD repository catalogue…
FreeBSD repository is up-to-date.
All repositories are up-to-date.
#

update ports

#portsnap fetch
#portsnap extract

pkg and ports give same version :

# cat /usr/ports/databases/percona56-server/Makefile | grep DISTVERSION
DISTVERSION=    5.6.19-67.0
MASTER_SITES=    http://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-${DISTVERSION}/source/tarball/
DISTNAME=    percona-server-${DISTVERSION}

# pkg install percona56-server
Updating FreeBSD repository catalogue…
FreeBSD repository is up-to-date.
All repositories are up-to-date.
The following 2 packages will be affected (of 0 checked):

New packages to be INSTALLED:
percona56-server: 5.6.19.67.0
percona56-client: 5.6.19.67.0

The process will require 121 MB more space.
10 MB to be downloaded.

Proceed with this action? [y/N]: n

Install using pkg will only need 10MB and much faster than ports so I’ll use pkg :-)

Stop MariaDB

# /usr/local/etc/rc.d/mysql.server.sh stop
Shutting down MySQL.. SUCCESS!

Re run pkg install

# pkg install percona56-server
Updating FreeBSD repository catalogue…
FreeBSD repository is up-to-date.
All repositories are up-to-date.
The following 2 packages will be affected (of 0 checked):

New packages to be INSTALLED:
percona56-server: 5.6.19.67.0
percona56-client: 5.6.19.67.0

The process will require 121 MB more space.
10 MB to be downloaded.

Proceed with this action? [y/N]: y

Fetching percona56-server-5.6.19.67.0.txz: 100%    8 MB 117.5k/s    01:13
Fetching percona56-client-5.6.19.67.0.txz: 100%    2 MB 110.0k/s    00:17
Checking integrity… done (0 conflicting)
[1/2] Installing percona56-client-5.6.19.67.0: 100%
===> Creating users and/or groups.
Using existing group ‘mysql’.
Using existing user ‘mysql’.
[2/2] Installing percona56-server-5.6.19.67.0: 100%

Its idle FreeBSD 10 server. Since I don’t know yet equivalent command for ‘free -m’ in FreeBSD I use top and export it to a file (maria for top process list when running mariadb and percona for top process list when running percona).

The result is :

# cat maria

last pid: 48064;  load averages:  0.08,  0.06,  0.07  up 0+01:20:00    14:41:12
23 processes:  2 running, 21 sleeping

Mem: 63M Active, 22M Inact, 89M Wired, 2492K Cache, 59M Buf, 306M Free
Swap: 1024M Total, 10M Used, 1014M Free

PID USERNAME    THR PRI NICE   SIZE    RES STATE    TIME    WCPU COMMAND
48059 mysql        23  52    0   457M 65512K sigwai   0:01   8.98% mysqld
911 alam          1  20    0 17576K  1504K select   0:10   0.00% sshd
779 root          1  20    0 10132K   408K nanslp   0:01   0.00% cron
915 root          1  23    0 10864K  1588K RUN      0:00   0.00% csh
772 root          1  20    0 12864K  1416K select   0:00   0.00% sendmail
908 root          1  20    0 17576K  1340K select   0:00   0.00% sshd
914 alam          1  20    0 10588K     0K wait     0:00   0.00% <su>
591 root          1  20    0 10096K   784K select   0:00   0.00% syslogd
47991 root          1  52    0 10472K  1716K wait     0:00   0.00% sh
912 alam          1  21    0 10476K     0K wait     0:00   0.00% <sh>
48064 root          1  23    0 11236K  1860K RUN      0:00   0.00% top
475 root          1  20    0  9380K    48K select   0:00   0.00% devd
775 smmsp         1  20    0 12864K     0K pause    0:00   0.00% <sendmail>
900 root          1  20    0 10084K   664K ttyin    0:00   0.00% getty
761 root          1  20    0 14816K  1268K select   0:00   0.00% sshd
906 root          1  52    0 10084K   664K ttyin    0:00   0.00% getty
907 root          1  52    0 10084K   664K ttyin    0:00   0.00% getty
901 root          1  52    0 10084K   664K ttyin    0:00   0.00% getty

# cat percona

last pid: 47972;  load averages:  0.02,  0.05,  0.07  up 0+01:19:09    14:40:21
23 processes:  2 running, 21 sleeping

Mem: 308M Active, 74M Inact, 90M Wired, 10M Cache, 59M Buf, 604K Free
Swap: 1024M Total, 65M Used, 959M Free, 6% Inuse

PID USERNAME    THR PRI NICE   SIZE    RES STATE    TIME    WCPU COMMAND
911 alam          1  20    0 17576K  1504K select   0:10   0.00% sshd
779 root          1  20    0 10132K   400K nanslp   0:01   0.00% cron
47962 mysql        23  33    0   612M   379M sigwai   0:01   0.00% mysqld
915 root          1  20    0 10864K  1296K RUN      0:00   0.00% csh
772 root          1  20    0 12864K  1416K select   0:00   0.00% sendmail
908 root          1  20    0 17576K  1340K select   0:00   0.00% sshd
914 alam          1  20    0 10588K     0K wait     0:00   0.00% <su>
591 root          1  20    0 10096K   784K select   0:00   0.00% syslogd
47866 mysql         1  52    0 10472K     0K wait     0:00   0.00% <sh>
912 alam          1  21    0 10476K     0K wait     0:00   0.00% <sh>
47972 root          1  20    0 11236K  1704K RUN      0:00   0.00% top
475 root          1  20    0  9380K    48K select   0:00   0.00% devd
775 smmsp         1  20    0 12864K     0K pause    0:00   0.00% <sendmail>
900 root          1  20    0 10084K   664K ttyin    0:00   0.00% getty
761 root          1  20    0 14816K  1268K select   0:00   0.00% sshd
906 root          1  52    0 10084K   664K ttyin    0:00   0.00% getty
907 root          1  52    0 10084K   664K ttyin    0:00   0.00% getty
901 root          1  52    0 10084K   664K ttyin    0:00   0.00% getty

I see big difference between them specially for percona but I don’t know how they use memory.

p.s :

MariaDB installled from source (MariaDB 10) and Percona Server from pkg on FreeBSD 10 that run from VirtualBox. I think I’ll try it on FreeBSD 10 64 bit on vps.