pkg: PACKAGESITE in pkg.conf is no longer supported.

As FreeBSD 10.1 spoil me with pkg then I stumble upon FreeBSD 9.2 box that installed due to its default ports. Yes another requirement of PHP 5.2.17 in the house yo.

The problem I encounter is :

# pkg info
pkg: PACKAGESITE in pkg.conf is no longer supported. Convert to the new repository style. See pkg.conf(5)
pkg: Cannot parse configuration file!

I guess that error lead to error problem when compile PHP 5.2.17 from ports.

……..

……….

Make sure index.php is part of your DirectoryIndex.

You should add the following to your Apache configuration file:

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

***************************************************************
====> Compressing man pages (compress-man)
===> Building package for php52-5.2.17_14
Creating package /usr/ports/lang/php52/work/pkg/php52-5.2.17_14.tbz
Registering depends: apache22-2.2.27_2 apr-1.5.1.1.5.3 gdbm-1.11 gettext-0.18.3.1 libxml2-2.8.0_5 libiconv-1.14_3 db48-4.8.30.0 pcre-8.34 perl5-5.16.3_9 expat-2.1.0.
Registering conflicts: php53-5* php5-5*.
Creating bzip’d tar ball in ‘/usr/ports/lang/php52/work/pkg/php52-5.2.17_14.tbz’
tar: bin/php: Cannot stat: No such file or directory
tar: bin/php-config: Cannot stat: No such file or directory
tar: bin/phpize: Cannot stat: No such file or directory
tar: etc/php.conf: Cannot stat: No such file or directory
tar: etc/php.ini-dist: Cannot stat: No such file or directory
tar: etc/php.ini-recommended: Cannot stat: No such file or directory
tar: include/php/TSRM/TSRM.h: Cannot stat: No such file or directory
tar: include/php/TSRM/acconfig.h: Cannot stat: No such file or directory
tar: include/php/TSRM/readdir.h: Cannot stat: No such file or directory
tar: include/php/TSRM/tsrm_config.h: Cannot stat: No such file or directory
tar: include/php/TSRM/tsrm_config.w32.h: Cannot stat: No such file or directory
tar: include/php/TSRM/tsrm_config_common.h: Cannot stat: No such file or directory
tar: include/php/TSRM/tsrm_nw.h: Cannot stat: No such file or directory
tar: include/php/TSRM/tsrm_strtok_r.h: Cannot stat: No such file or directory
tar: include/php/TSRM/tsrm_virtual_cwd.h: Cannot stat: No such file or directory

Yes.

# ls /usr/local/etc/ | grep pkg
pkg.conf
pkg.conf.sample

Replace pkg.conf

# mv /usr/local/etc/pkg.conf.sample /usr/local/etc/pkg.conf

# pkg info
pkg-1.4.6 Package manager

NO error this time.

# echo ‘NO_WARNING_PKG_INSTALL_EOL=yes’ >> /etc/make.conf

pkg update
Updating FreeBSD repository catalogue…
pkg: Repository FreeBSD has a wrong packagesite, need to re-create database
Fetching meta.txz: 100% 968 B 1.0k/s 00:01
Fetching packagesite.txz: 100% 5 MB 230.6k/s 00:23
Processing entries: 100%
FreeBSD repository update completed. 23846 packages processed

Re try compile but not work but at least “pkg: PACKAGESITE in pkg.conf is no longer supported.’ no longer appear.

Install Drupal 8 with phpng (php next generation) on FreeBSD 10.1

After get success with php next generation (phpng) installation I decide to test it with real php script. Drupal came to my attention and I came with a plan of recipe :-)

  • Drupal 8 (at the moment its 8.0.0-beta4)
  • PHP 7.0.0-dev
  • Lighttpd
  • MariaDB 10

I still use Vultr as Vps provider since my adsl connection is sucks at the moment.

Lets get start

Install MariaDB 10

I use pkg approach than using source way that I did before.

Delete previous installed mysql client

# pkg info | grep mysql
mysql56-client-5.6.22 Multithreaded SQL database (client)
# pkg delete mysql56-client
Checking integrity… done (0 conflicting)
Deinstallation has been requested for the following 1 packages (of 0 packages in the universe):

Installed packages to be REMOVED:
mysql56-client-5.6.22

The operation will free 45 MB.

Proceed with deinstalling packages? [y/N]: y
[1/1] Deinstalling mysql56-client-5.6.22…
[1/1] Deleting files for mysql56-client-5.6.22: 100%

Install MariaDB 10 server and Client

# pkg install -y mariadb100-server mariadb100-client

Enable MariaDB from rc.conf

# echo 'mysql_enable=YES' >> /etc/rc.conf

Start MariaDB Service

# /usr/local/etc/rc.d/mysql-server start

Change MariaDB root password

# /usr/local/bin/mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we’ll need the current
password for the root user. If you’ve just installed MariaDB, and
you haven’t set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on…

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
… Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
… Success!

Normally, root should only be allowed to connect from ‘localhost’. This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
… Success!

By default, MariaDB comes with a database named ‘test’ that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
– Dropping test database…
… Success!
– Removing privileges on test database…
… Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
… Success!

Cleaning up…

All done! If you’ve completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Add new user for upcoming drupal installation

# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 10.0.15-MariaDB FreeBSD Ports

Copyright (c) 2000, 2014, Oracle, SkySQL Ab and others.

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

MariaDB [(none)]> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [mysql]> create database drupal;
Query OK, 1 row affected (0.00 sec)

MariaDB [mysql]> grant all privileges on drupal.* to drupal@localhost identified by ‘123456’ with grant option;
Query OK, 0 rows affected (0.00 sec)

MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.01 sec)

MariaDB [mysql]> exit
Bye
#

Compile phpng

I compile phpng using last post.

# mkdir $HOME/tmp/usr/etc

# /root/tmp/usr/etc/php.ini

add these lines

max_execution_time=600
memory_limit=128M
error_reporting=0
display_errors=0
log_errors=0
user_ini.filename=
realpath_cache_size=2M
cgi.check_shebang_line=0

zend_extension=opcache.so.0.0
opcache.enable_cli=1
opcache.save_comments=0
opcache.fast_shutdown=1
opcache.validate_timestamps=1
opcache.revalidate_freq=60
opcache.use_cwd=1
opcache.max_accelerated_files=100000
opcache.max_wasted_percentage=5
opcache.memory_consumption=128
opcache.consistency_checks=0

Install Lighttpd

# pkg install -y lighttpd
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:
lighttpd: 1.4.35_5
pcre: 8.35_2

The process will require 6 MB more space.
1 MB to be downloaded.
Fetching lighttpd-1.4.35_5.txz: 100% 215 KB 219.8k/s 00:01
Fetching pcre-8.35_2.txz: 100% 1 MB 1.1M/s 00:01
Checking integrity… done (0 conflicting)
[1/2] Installing pcre-8.35_2…
[1/2] Extracting pcre-8.35_2: 100%
[2/2] Installing lighttpd-1.4.35_5…
[2/2] Extracting lighttpd-1.4.35_5: 100%

Set Lighttpd run on boot

# echo 'lighttpd_enable=YES' >> /etc/rc.conf

Create document root

# mkdir -p /usr/local/www/data

# touch /usr/local/www/data/index.html

# echo 'tes' > /usr/local/www/data/index.html

Lighttpd Configuration

modules.conf

# ee /usr/local/etc/lighttpd/modules.conf

remove # sign in front of this line:

##
## FastCGI (mod_fastcgi)
##
include “conf.d/fastcgi.conf”

save the file.

# ee /usr/local/etc/lighttpd/conf.d/fastcgi.conf

Add these lines under “server.modules += ( “mod_fastcgi” ) ” : source.

fastcgi.server = ( “.php” => ((
“bin-path” => “/root/tmp/usr/bin/php-cgi”,
“socket” => “/tmp/php.socket”,
“max-procs” => 2,
“bin-environment” => (
“PHP_FCGI_CHILDREN” => “16”,
“PHP_FCGI_MAX_REQUESTS” => “10000”
),
“bin-copy-environment” => (
“PATH”, “SHELL”, “USER”
),
“broken-scriptfilename” => “enable”
)))

Enable fastcgi

Make sure output of

# /root/tmp/usr/bin/php-cgi -v

PHP 7.0.0-dev (cgi-fcgi) (built: Jan 23 2015 04:55:05)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.8.0-dev, Copyright (c) 1998-2014 Zend Technologies

cgi-fcgi means fast cgi enabled.

Testing phpinfo()

# echo "<?php phpinfo();?>" > /usr/local/www/data/info.php

See it from browser.

freebsd_vps_europe_7

 

Fix Lighttpd error message

(network.c.283) warning: please use server.use-ipv6 only for hostnames, not without server.bind / empty address; your config will break if the kernel default for IPV6_V6ONLY changes

That message show up when lighttpd restart.

 

Install Drupal 8

I’ll continue it next time :-)

How to install phpng aka php7 on FreeBSD 10

I just curious about php next generation aka phpng aka php7 . After a few times fail with hhvm ( FreeBSD hhvm and DragonFlyBSD hhvm) I think I need to test something different for my lab experiment :-)

The choice came to phpng and with the help from Vultr I can cure my curiosity in fast deployment. Well,

I use this configuration :

VPS location : Germany (Frankfurt), Europe.

freebsd_vps_europe1

FreeBSD version : FreeBSD 10 64 bit

freebsd_vps_europe2

Specs : 1 cpu, 768 MB memory, 15 GB storage and 1000 GB transfer.

freebsd_europe_vps_4

Great, Hit ‘Place Order’ button and I can test it.

Steps :

Most of step taken from php.net wiki of phpng.

1. Log in to server using ssh

freebsd_europe_vps5

Continue reading

Rebuild Fedora as Server using VPS and custom iso

Today task is little different. Old php script that run on PHP 5.2.9 and utilize mysql 5.0.88 need to rebuild in other place. That way another group of developer can add or inspect why new injected code can behave odd in such environment (they already try new code using newer PHP and it work well).

As far I can see from server log in message its Fedora 10 and using old PHP and old Mysql version. I need to replicate it in some place. Where we (I and developer) can log in and see it together.

Target for this server is same php and same mysql version :

#rpm -qa | grep php

php-common-5.2.9-2.fc10.i386
php-pgsql-5.2.9-2.fc10.i386
php-pecl-apc-3.0.19-1.fc10.i386
php-5.2.9-2.fc10.i386
php-gd-5.2.9-2.fc10.i386
php-mysql-5.2.9-2.fc10.i386
php-ldap-5.2.9-2.fc10.i386
php-mbstring-5.2.9-2.fc10.i386
php-mcrypt-5.2.9-2.fc10.i386
php-odbc-5.2.9-2.fc10.i386
php-pear-1.7.2-2.fc10.noarch
php-cli-5.2.9-2.fc10.i386
php-pdo-5.2.9-2.fc10.i386
phpMyAdmin-3.2.3-1.fc10.noarch

# rpm -qa | grep mysql

mysql-5.0.88-1.fc10.i386
mysql-server-5.0.88-1.fc10.i386
php-mysql-5.2.9-2.fc10.i386
mysql-connector-odbc-3.51.26r1127-1.fc10.i386
libdbi-dbd-mysql-0.8.3-2.fc10.i386
mysql-libs-5.0.88-1.fc10.i386

VPS is my option  and Vultr (I choose $5/month specs that come with 15GB SSD storage and 768MB memory) can help me for this case .

Log in to Vultr and upload iso

  1. For Fedora 10 64 bit click here.
  2. For Fedora 10 32 bit click here.

Since I need to replicate it with minimum hassle I decide to use 64 bit in DVD format.

Create Server

After iso file successfully uploaded then I Choose custom iso selected Fedora 10 file.

fedora10_vps : virtual iso

After hit ‘deploy server’ wait for moment to take control.

Install Fedora Server in VPS

In case you see ipxe message in ‘console’ then you must make sure iso file attached. Check from virtual iso menu. If it’s not then select Fedora images and click ‘attach iso and reboot’ button.

fedora10_vps2 : attach iso

 

This view is the right one.

fedora10_vps3 : remove attached iso

Go back to manage server menu and choose ‘console’ link. If you see this then iso attach process working well.

fedora10_vps4 : install serverThe rest of installation step is as usual.

For partition I choose to use all disk space.

fedora10_server5 : web server chosen etcWeb server and repositories (installation repo, Fedora 10 -x86_64 and updates).

Reboot and configure it for first time as usual till you see this view (already login)

fedora10_vps6 : successfully installed

Disable GUI login and X-Window on Fedora

Yes, of course its server. No X windows please :-)

Open terminal from console and edit /etc/inittab and change this line :

id:5:initdefault:

into

id:3:initdefault:

save.

In this stage also make sure to remove iso from custom iso menu for this server.

After server reboot you’ll see no more X-Window.

fedora10_vps7

Control Fedora Server using ssh

By default ssh server already installed and running. Vultr system will make sure right ip assigned for this VPS and you just need to access it from ipv4 provided.

fedora10_vps8

 

free -m

# free -m
total used free shared buffers cached
Mem: 748 169 578 0 6 57
-/+ buffers/cache: 105 642
Swap: 1503 0 1503

# df -H
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
15G 3,4G 10G 26% /
/dev/vda1 200M 15M 175M 8% /boot
tmpfs 393M 0 393M 0% /dev/shm

Check PHP

# rpm -qa | grep php

php-5.2.9-2.fc10.x86_64
php-ldap-5.2.9-2.fc10.x86_64
php-common-5.2.9-2.fc10.x86_64
php-pdo-5.2.9-2.fc10.x86_64
php-cli-5.2.9-2.fc10.x86_64
php-mysql-5.2.9-2.fc10.x86_64

Check MySQL

# rpm -qa | grep mysql

mysql-libs-5.0.88-1.fc10.x86_64
php-mysql-5.2.9-2.fc10.x86_64

I can see the result is different. I use 64 bit while existing server use 32 bit and few extension not installed. In general Vultr can help me rebuild the server. I just need to more careful and diligent :-)

# yum install php-gd php-mcrypt php-mbstring php-pecl-apc mysql-server

For iptables etc remain same as Install PHP 5.2.17 on CentOS 5.10.

For Selinux case I prefer to disable it :

# nano /etc/selinux/config

change enforcing to disabled .

 

Compile HHVM 3.4 on DragonFlyBSD 4

My last experiment with HHVM is testing compile it with HHVM LTS (its version 3.3) on FreeBSD 10. Since HHVM 3.4 is out I think I’ll try it again with FreeBSD 10 but since I just install DragonFlyBSD 4 then I think I’ll give it try.

Another reason is I just curious to see implementation of DragonFlyBSD in many field. By share it to others perhaps I can contribute too.

Ok, lets go back to topic.

I use DragonFlyBSD 4 that I install recently. It has 2 cpu and memory 2GB plus hammer filesystem enabled.

See current installed package

# pkg info
bind-tools-9.10.1_3 BIND DNS suite with updated DNSSEC and DNS64
ca_root_nss-3.17.2_1 The root certificate bundle from the Mozilla Project
cdrtools-3.00_2 CD/DVD/BluRay and ISO-9660 image creation and extraction tools
curl-7.38.0_2 Non-interactive tool to get files from FTP, GOPHER, HTTP(S) servers
cvsps-2.1_1 Create patchset information from CVS
expat-2.1.0_1 XML 1.0 parser written in C
gettext-0.18.3.1_1 GNU gettext package
git-2.1.2 Distributed source code management tool
idnkit-1.0_5 Library to handle internationalized domain names
indexinfo-0.2 Utility to regenerate the GNU info page index
isc-dhcp42-server-4.2.7 The ISC Dynamic Host Configuration Protocol server
libxml2-2.9.2_2 XML parser library for GNOME
openssl-1.0.1_16 SSL and crypto library
pkg-1.3.8_3 Package manager

Continue reading