Saturday, November 21, 2015

-C amd64 X200: Installing Odoo 8/9 using git.

Hi,

Personally, I've been waiting for this little project. Remember my post earlier regarding tryton? Well, here comes the good stuff. Odoo.

I used this info to install Odoo 9, the newest version but then after opening the web, the display is all over the places. Text overlapping and the sections not displayed correctly. So I used this same method and install Odoo 8, which only shown a one-time "JQuery outdated" version warning but doesn't ruin the experience.

What I'm trying to do is:
-Install Odoo 8 (Odoo 9 should be no different) - done
-Use Httpd to serve the web - not yet
-Autostart Odoo 8 after boot - not yet

I'm using this sites for references, which is great help.
https://www.odoo.com/documentation/8.0/setup/install.html
http://www.dvatp.com/tech/odoo_on_freebsd

Take note that this installation is supposed to be for Odoo 9, but after few showstopper, I downloaded Odoo 8 and run on-top of this method, which has no bad effect. Yet.

First, install all required programs.
Install git
$ su root -c 'pkg_add git'

Install Python 2.7

Install py-pip, then use pip to install setuptools and then upgrade it. It's because I had "egg_info" error in Odoo 9 if I didn't upgrade it. Then install python-ldap, as the python-ldap listed in Odoo's requirement.txt cannot be installed (more on this later). Then also I need to install py-psutil using pkg_add, instead of pip because I got "platform openbsd5 not supported" when installing. Then I upgrade psutil using pip.
$ su root -c 'pkg_add py-pip'
$ doas pip install --upgrade pip
$ doas pip install setuptools
$ doad pip install --upgrade setuptools
$ doas pip install python-ldap
$ su root -c 'pkg_add psutil'
$ pip install --upgrade psutil

Install NodeJS. In OpenBSD it's called node. First install node using pkg_add, then upgrade it using npm, then using npm to install less and less-plugin-clean-css and upgrading 'em.
$ su root -c 'pkg_add node'
$ doas npm install -g npm
$ doas npm install less
$ doas npm install -g less
$ doas npm install less-plugin-clean-css
$ doas npm install -g less-plugin-clean-css

Install PostgreSQL

Install this optional programs, in my system half of it has already been installed.:
graphviz
ghostscript
poppler
antiword
curl
wkhtmltopdf
LibreOffice

Setting up Odoo 8 and PostgreSQL database for it.

Ok, for PostgreSQL, I just create a superuser named "odoo" which will require password.
$ createuser -U postgres -P -s odoo

Then I need to insert password for that new user.

Using Git, I download the latest Odoo 8.0 branch. I'm putting this in my home directory.
$ cd ~
$ git clone --depth 1 --branch 8.0 https://www.github.com/odoo/odoo

Yes, it's 2 "odoo" folder. Wait for it to finish downloading. After that you can see an "odoo" directory inside. Then go inside that directory.
$ cd odoo

Then I need to use pip to install the dependencies needed for Odoo 8.
$ doas pip install -r requirements.txt

This is when I have problem on psutil which gave "platform openbsd5 not supported" error, that's the reason I installed it above via pkg_add (not sure if odoo will use this other version.)

Then also I got an error about python-ldap cannot be installed. That's also the reason I installed python-ldap using pip manually. So, to make sure that the installation advances, I deleted those 2 requirement from the.. err.. requirement.txt.

In Odoo 9's requirement.txt:
psutil==2.2.0
python-ldap==2.4.19

In Odoo 8's requirement.txt:
psutil==2.1.1
python-ldap==2.4.15

Then run again the pip installer:
$ doas pip install -r requirement.txt

It's done! Now to create the configuration file. I created ".openerp-serverrc" file inside my home directory.
$ vi ~/.openerp-serverrc

--------- ~/.openerp-serverrc start ---------
[option]
db_host = 127.0.0.1
db_port = 5432
db_user = odoo
db_password = mypass
addons_path = /home/myhome/odoo/addons
--------- ~/.openerp-serverrc ends ---------

Done. Now I need to run the server and then configure Odoo via web.
$ cd ~/odoo
$ ./odoo.py &

In that same terminal, I can see all the info on what Odoo is currently doing. Then, in browser, open http://127.0.0.1:8069 or http://localhost:8069.


This screenshot is for Odoo 9. For Odoo 8, the page is different but the input required is the same. In Odoo 9, after database creation, my Odoo homepage is chaos. Like I've said earlier, text overlapping, display corruption etc. And then there's 'Could not execute command 'lessc' on the top-left side.  I read that I need to update less and less-plugin-clean-css via npm.

$ doas npm install -g less
$ doas npm install -g less-plugin-clean-css

Then I drop the database by using this page:
http://localhost:8069/web/database/manager

Delete the database, then go to the start page to create new. Still the same issue. So then I download Odoo 8.0 branch instead (this method above is for Odoo 8.0 branch).

In Odoo 8, when I open the start page for the first time, there's error about JQuery version being old version, but still can load Database Manager page. After creating database, the page doesn't refresh to load the main page. I need to see the term I run ./openerp-server and see if it's idling. After that I open up the home page.


As you can see, there's the warning message. It doesn't cripple the site, AFAIK but I'm looking into this later. Currently I've installed the accounting module and all seems to be working fine.

Update 26/11/2015:
Good news. Odoo 9.0 is working now. The "lessc" issue has been resolved. What I did was update the NodeJs's npm and then less and less-plugin-clean-css

$ doas npm install -g npm
$ doas npm install -g less less-plugin-clean-css

Then I started my Odoo 9. It's working! I'm not sure why the initial npm update above is not working. Anyway, it's good to know that it's working now.

ToDo: Set up httpd for Odoo 8
ToDo: Set up Odoo 8 in rc.d for automatic boot and shutdown.

p/s: I changed the Administrator's profile and when I tried to open back the home page, I was asked to enter email and password. I tried everything and can't log in. But then I didn't try this:

Email: admin
Password: my_odoo's_PgSQL's_password

And then only I can log in. Later.

Thursday, November 12, 2015

-C amd64 X200: Using xdimmer to dim the laptop monitor.

Hi,

Great news. I've been using this since I updated my snapshot a few days ago now. This is the utility that I've been waiting for!

xdimmer

http://openports.se/x11/xdimmer

"xdimmer is a small utility to automatically dim the screen when
no keyboard or mouse input has been detected in the configured
number of seconds, and brighten it once input is detected."

What a great battery saver! So, as I'm using ~/.xsession, I just add this line before the execution of my window manager (cwm, what else!):

xdimmer -t 360 &

So, after 360 seconds of keyboard/mouse inactivity, xdimmer will dim my laptop's monitor to the default percentage (which is 5 percent).

Thanks to the contributor! Later.

-C amd64 X200: LibreOffice 5 is here!

Hey,

Updated my lappy to the new snapshots a few days ago and now it's LibreOffice 5 time! Yeah!. Nice OpenBSD, nice.

Later.

Wednesday, September 30, 2015

5.8-C amd64 X200: Lock X after suspend.

Hi,

Got a good tips from OpenBSD.newbies mailing list. How to lock the machine after suspend. Ok, normally, if I didn't xlock my X session and put the machine under suspend mode (eg: close the lid), my session will be restored when the machine wakes. My session is exposed. So here's how to automatically lock the session when the machine goes into suspend mode.

1) Create a suspend file inside /etc/apm.
In my machine, there's no /etc/apm folder. So I need to create it first. Then create a suspend file inside it.

$ doas mkdir /etc/apm
$ doas vi /etc/apm/suspend

----- /etc/apm/suspend starts -----
#!/bin/sh
pkill -USR1 xidle
----- /etc/apm/suspend ends -----

Then I need to make this suspend executable.

$ doas chmod 744 /etc/apm/suspend

2) Get xidle running on start.
I edited my
.xsession file and add this text:
----- ~/.xsession starts -----
xidle &
----- ~/.xsession ends -----

Then I run the xidle program.

$ xidle &

So basically when I close my machine's lid, suspend will trigger xidle to lock the machine. Nice stuff.

Reference:
http://www.mail-archive.com/openbsd-newbies@sfobug.theapt.org/msg00043.html

5.8-C amd64 X200: Bye sudo, hi doas.

Hey,

Done updating, rebuilding the userland and following the.. err.. "Following -current" guide, now to reboot.

$ sudo reboot
ksh: sudo: not found

Oh. Yeah. I forgot. sudo is old news. Now it's doas time.

man doas
man doas.conf

Now, after all the setups, all I have to do to reboot is:

$ doas reboot

http://www.tedunangst.com/flak/post/out-with-the-old-in-with-the-less

http://www.tedunangst.com/flak/post/doas

Now it's just a matter of learning new habit. Later.

Tuesday, September 29, 2015

5.8-C amd64 X200: httpd error after upgrading snapshot.

Hi,

I downloaded the 29th September's SNAPSHOT and installed it successfully. But, after I rebooted, this error greeted me:

httpd(xxxx): syscall 5

The "xxxx" is replaced by bunch of numbers. Ouch. Searching the net about this but found no answer so far. I'm guessing that this is related to php, php-fpm or something. But I'm not sure.

UPDATE 30/09/2015:
Ok I asked misc regarding this and Ted Unangst has given the answer:

"The latest snapshots include a bunch of tame() calls in userland programs, but some of them were added optimistically. httpd is trying to do something it's not yet permitted to do.

For now, please report such errors.

If you need a working version, the diffs aren't committed yet, so you can rebuild httpd from source and it should work fine."


http://www.mail-archive.com/misc@openbsd.org/msg141426.html

Now, who said that the devs are bunch of man-eating-flame-throwing monster? As long as we search for answer first before asking (to see if it's already been asked and/or solved), and provide sufficient details (dmesg, related .conf files etc) when asking, you will get informative answers.

Ok. So it's basically new stuff in the httpd's snapshot. And to get a working httpd, I need to rebuild it. I've done port installation stuff but rebuilding a base program? I've never done this. But this is a good learning process. So I use the official guide:

http://www.openbsd.org/faq/faq5.html#Bld

I follow the "Following -current" guide. Then build the userland (I didn't build the kernel). It took some time. When it's done, I rebooted and httpd is working again! Yeah!

I noticed there's changes about php-fpm so I go through the Following -current page:

http://www.openbsd.org/faq/current.html#20150918

The previously named php_fpm rc script has been renamed according to PHP's version installed. So I edited my /etc/rc.conf.local.

----- /etc/rc.conf.local starts -----
pkg_scripts=php56_fpm
----- /etc/rc.conf.local ends -----

Just to be sure, I pkg_delete php-fpm then reinstall it. Reboot.

All is ok now. Thanks to Ted Unangst and all the people in misc@OpenBSD.

I think there's a way to just rebuild httpd, without rebuilding all userland. I'm searching for info on this.

Update 1st October 2015:

Stuart Henderson @misc has given a tip on how to update just the httpd.

$ cd /usr/src/usr.sbin/httpd
$ cvs up -PdA
$ make obj && make depend && make
$ su root -c 'make install'

 http://article.gmane.org/gmane.os.openbsd.misc/225370

Nice!. Learning something new everyday. Later.

Saturday, September 26, 2015

5.8-C amd64 X200: Drupal 7 Multisite.

Hey,

Why multisite? I read quite a bit of discouragement about this topic. Well, this is a local installation and it is a development (or hope to be) machine so I will (or might) be doing multiple sites. Hence the need.

My reference will be this site:

https://www.drupal.org/documentation/install/multi-site

You might need to refer to my previous posts as I might not be duplicating what is unnecessary here.

1) Preparing the site.
My default drupal site is drupal.example.com. So, I think I want to create another site called drupal2.example.com. I create a folder inside Drupal's sites folder.

$ cd /var/www/htdocs/drupal7/sites/
$ sudo mkdir drupal2.example.com

Along with that, I need to create a files folder inside my new drupal2's folder.

$ sudo mkdir -pm 777 drupal2.example.com/files

The files will need to be fully writeable as installation will gave error or not able to write inside that folder.

Folder creation done, now to set up appropriate files. Inside sites folder, there a file named example.sites.php. For a single-site.. err.. site, no need to touch this file but as I'm trying to create a multisite.. err.. site now, I need to edit this file. First I need to copy this file as sites.php file.

$ sudo cp example.sites.php sites.php

Now to edit this, adding this text at the bottom (bolded):

----- sites.php starts -----
<?php
* text snipped *

$sites['drupal2.example.com'] = 'example.com';
?>
----- sites.php ends -----

Yeah you read it right, I also included the closing tag for php as there's none there. Then I need to copy default.settings.php and put it as settings.php inside drupal2.example.com folder.

$ sudo cp sites/default/default.settings.php sites/drupal2.example.com/settings.php

Now to edit this file. I need to find and edit the $databases = array () occurances and change it to this.

----- drupal2 settings.php starts -----
$databases = array (
  'default' =>
  array (
    'default' =>
    array (
      'database' => 'drupal2',
      'username' => 'drupal',
      'password' => 'password',
      'host' => 'localhost',
      'port' => '',
      'driver' => 'pgsql',
      'prefix' => '',
    ),
  ),
);
----- drupal2 settings.php ends -----

Remember this. I'm using PostgreSQL. This file is to set up my currently-non-existant new drupal2.example.com site's database. This part of the setup is complete.

2) Set up the database.
The command for PostgreSQL is:

$ createdb -U drupal -E UTF8 drupal2

For clarification, refer to my previous post about Drupal 7's installation. Basically I'm creating a black database using the "drupal" username with UTF8 encoding (needed!) and the name of that database is "drupal2". Make sure that the previous settings.php is configured according to this informations.

3) Set up the (local) domain.
I edited the /etc/hosts file.

----- /etc/hosts starts -----
127.0.0.1 drupal2.example.com
----- /etc/hosts ends -----

There's also other entries inside that file but I'm just showing the changes.

4) Configure HTTPd.
I edited the /etc/httpd.conf and inserted these text.

----- /etc/httpd.conf starts -----
server "juadah.example.com" {
        listen on $ext_addr port 80

        directory {
                index "index.php"
        }

        location "*.php*" {
                fastcgi socket "/run/php-fpm.sock"
        }

        root "/htdocs/drupal7"
}
----- /etc/https.conf ends -----

This is just a basic configuration. This should be it. Now to install the new site. I open up my browser, and type the new URL drupal2.example.com.

PDOException: SQLSTATE[42P01]:

Wha..?. I received errors instead talking about some PDO stuff. Ouch. After searching for a while, I found the answer. Wrong URL. The correct one for installation is:

drupal2.example.com/install.php

Then the installation went through. I got 2 warning when installing. 1 is for the files directory not writeable (hence the steps above) and the other one is about the unicode issue, refer my previous post as I need to patch the Drupal installation again because, hey, I'm following -CURRENT. Later.

Saturday, September 12, 2015

5.8-C X200 amd64: lib.c.81 not found after upgrading -current, and bunch of others.

Okay, so here I was, updating my -current system. Because, yeah, it's been a while. Fired up my ftp, grab the bsd*, *tgz and all, the usual stuff. Upgraded my system, done changing timezone and sysmerge. All is good. So I upgraded my packages. This is what happened.

Update candidates: xz-5.2.1 -> xz-5.2.1
Can't install xz-5.2.1 because of libraries
|library c.81.0 not found
| /usr/lib/libc.so.78.1 (system): bad major
| /usr/lib/libc.so.79.0 (system): bad major
| /usr/lib/libc.so.80.0 (system): bad major
| /usr/lib/libc.so.80.1 (system): bad major
| /usr/lib/libc.so.82.0 (system): bad major

Ack!. Then I this bunch of warnings like:

Can't install pkg_name because of libraries

Ok. Not bunch. But a lot. I'm guessing that this is about new version of libraries. So, after searching for answers, I found this:

http://comments.gmane.org/gmane.os.openbsd.misc/224817

Whew I'm grateful this is not because of some mistakes I made while upgrading. I even did another upgrade just to make sure. Yeah, so I need to wait for a few days before upgrading my packages. Later.

Wednesday, September 02, 2015

5.8-S amd64 X200: httpd Virtual Host.

Hi,

I've been having headache trying to solve the Virtual Hosting issue when using OpenBSD's new httpd (starting from 5.7) included in the base. After fairly quite a lot a trial and errors (mostly errors) and nearly downloading nginx today, I finally got the Virtual Host working now.

I really like the concept of OpenBSD's new httpd. Simple configuration, the devs are keeping the code simple and it's in the base. I also got Drupal 7 working fine (except for clean url, which is minor as this is for developing, not production) and I'm having fun learning Drupal here. But so far, I only managed to get 1 site working at a time. That means, I need to reconfigure my /etc/httpd.conf every time I want to change the website I want to work on. If I only want to work on a single site, this would not pose a problem. But I have more than 1 website I want to work on, so this is tiring me down.

I know that the httpd is chrooted by default, but I didn't know how to configure it properly until now. Well "properly" is not as "perfect" but more to "got it to work" kind of saying. So please correct me if you find anything that's wrong here. So here it goes.

My scenario, I'm working in 1 Drupal 7 site, then 1 another html/php site. The directory is as below:

/var/www/htdocs (the /var/www is the chroot directory)
/var/www/htdocs/drupal7 (my drupal dev directory, the default as installed)
/var/www/htdocs/karl (my html/php dev site)

For Drupal 7 installations and configurations, you can check my previous post. Now here's my /etc/httpd.conf.

---- /etc/httpd.conf start ----

# Macros
ext_addr="*"

# Server
server "default" {
    listen on $ext_addr port 80

    directory {
        auto index
    }

    location "*.php*" {
        fastcgi socket "/run/php-fpm.sock"
    }

    location "/cgi-bin/*" {
        fastcgi
        root "/"
    }

}

---- /etc/httpd.conf end ----

Now that's for the default site. I noticed that if I change the upper part to:

server "www.example.com" {
    listen on $ext_addr port 80
    alias "example.com"


Then if I just type "example.com" in my browser, it will display my local site's main page instead of the internet's site. Take note that it's easier to use "Private Window" (Firefox) or "Incognito Window" (Chrome) for testing purpose. I also set the index to be created automatically because I don't want to create any site inside the root "/htdocs" directory and this is just a local development machine. Now for the Virtual Host setting inside /etc/httpd.conf.

---- /etc/httpd.conf continues ----

# virtual server for Drupal
server "drupal.example.com" {
    listen on $ext_addr port 80

    directory {
        index "index.php"
    }

    location "*.php*" {
        fastcgi socket "/run/php-fpm.sock"
    }

    root "/htdocs/drupal7"

}

# virtual server for Karl
server "karl.example.com" {
    listen on $ext_addr port 80

    location "*.php*" {
        fastcgi socket "/run/php-fpm.sock"
    }

    root "/htdocs/karl"

}

types {
    includes "/usr/share/misc/mime.types"
}


---- /etc/httpd.conf ends ----

Now this is the simplest working form of my /etc/httpd.conf. On httpd side, this should be ok. Now for the important part, making the Virtual Host part work. As httpd works in chroot by default, it will only access files inside /var/www for safety reason. So I need to create an etc directory inside /var/www.

# mkdir /var/www/etc

Then I need to copy /etc/hosts and /etc/resolv.conf into /var/www/etcb.

# cp /etc/hosts /var/www/etc
# cp /etc/resolv.conf /var/www/etc

This is the content of both files:

---- /var/www/etc/hosts start ----

127.0.0.1    localhost    www.example.com
::1    localhost    www.example.com

---- /var/www/etc/hosts end ----

---- /var/www/etc/resolv.conf start ----

# Generated by em0 dhclient
search Home
nameserver 127.0.0.1
lookup file bind

---- /var/www/etc/resolv.conf end ----

Ok. I was thinking that to make Virtual Host using httpd works, I need to edit that /var/www/etc/hosts file, as that is the chroot directory. I was wrong. I didn't manage to get the Virtual Host working by editing that file. It was the /etc/hosts file that needs editing. Here's mine.

---- /etc/hosts start ----

127.0.0.1    localhost    www.example.com
127.0.0.1    drupal.example.com
127.0.0.1    karl.example.com
::1    localhost    www.example.com

---- /etc/hosts end ----

I only use 2 Virtual Hosts as of now, but I'm guessing that more can be set up with appropriate configuration changes. So now I restarted the httpd.

# sudo /etc/rc.d/httpd restart

Open up my browser, typed all 3 urls:

www.example.com
drupal.example.com
karl.example.com

and all open up the appropriate pages. I'm loving this! Now this leave only 1 more minor thing to be done, the Clean URL. But like I've said, it's only a minor thing. Later.

Wednesday, August 19, 2015

-SNAPSHOT amd64 X200: Drupal 7 module installation error.

Hi,

So far I'm still learning about Drupal. I have a project in mind using this. So I wanted to install a module into this Drupal-o-mine.

First, I need to enable FTPd. I edited /etc/rc.conf.local file and add this:

ftpd_flags=

Then I start the daemon by using:

# sudo /etc/rc.d/ftpd start

I open Drupal's page using web browser. In Drupal's Home page, I click on "Modules" link on the top bar and then click on "+ Install new module" link on the Module's page. I've already downloaded the module's tar.gz file so choose that file and then click "Install".

The "Update Manager" page appears. The "Connection method" only have "FTP" so nothing to change there. The "User" is my login's user name. Then the password is my login pass. I leave the "ADVANCE SETTINGS" as it is then click on "Continue" button.

Error message

Installation failed! See the log below for more information.

recipe

  • Error installing / updating
  • File Transfer failed, reason: Cannot create directory /htdocs/drupal7/sites/all/modules

Next steps



This is the error I received. Yeah I know it's permission issue (and might even be the current Drupal's bug) and I tried everything below without success:

-Change "htdocs/drupal7/sites/all/modules" owner and permission.
-Change the tar.gz file permission.

I will search for answer and if this is the current Drupal's bug (https://www.drupal.org/node/842620), I might try manual module installation. Later

Friday, August 07, 2015

SNAPSHOT amd64 X200: httpd + PostgreSQL + Drupal 7.

Hey,

Starting with 5.7, OpenBSD have their own httpd replacing nginx in base. This httpd is fairly new and un/fortunately I'm trying to learn Drupal nowadays. Sure I can install Apache or nginx from port but I want to test the new httpd.

Take note!
1) I'm currently on -CURRENT using snapshot.
2) I never installed drupal or any web app before.
3) This is a Work In Progress and will be updated until it's done.

So I guess that's quite a warning for you guys. My installation might not be the correct one or might not even install correctly but I will try to make sure I find out how to make this work. Googling for info on the new httpd with Drupal only return less than handful of info. But as always, web searching is needed. So without any delays, here I go.


SETTING UP HTTPD.
As I'm going Openbsd's own (and new) httpd, the program has been already installed. To enable it, I just need to edit /etc/httpd.conf. I commented all the entries in that file except for this few lines (mostly the "A minimal default server" entries).

---- /etc/httpd.conf start ----
# Macros
ext_addr="*"

# A minimal default server
server "default" {
listen on $ext_addr port 80

location "*.php" {
fastcgi socket "/run/php-fpm.sock"
}
root "/htdocs"

}

# Include MIME types instead of the built-in ones
types {
include "/usr/share/misc/mime.types"
}
---- /etc/httpd.conf end ----

As a simple rule-of-a-thumb, start with the minimum configuration then adjust from there. It's easier to check for error/mistakes. As Drupal is a PHP program, I need to install PHP. I also will be using PostgreSQL for the database. What I've installed is:

php-5.6.11
php-fpm.5.6.11p0
php-gd-5.6.11 (this might be dependency, I can't recall right now)
php-pdo_pgsql-5.6.11 (I'll be using PostgreSQL instead of MySQL)
postgresql-client-9.4.4
postgresql-contrib-9.4.4
postgresql-docs-9.4.4 (optional, but I want it)
postgresql-server-9.4.4

As we can see in the /etc/httpd.conf, there's "php-fpm" entry. As the package has been installed, I need to make it start at boot along with httpd by editing /etc/rc.conf.local.

---- /etc/rc.conf.local start ----
httpd_flags=
slowcgi=
pkg_scripts=php_fpm postgresql

---- /etc/rc.conf.local end ----

The "slowcgi" came with httpd, so I add it in /etc/rc.conf.local. Now we can either start httpd, slowcgi & php-fpm manually now or reboot. Unlike Apache, there's no template webpage that you can see after your httpd has started. So I created a Hello World-like index.html file inside the webserver's root directory which is /var/www/htdocs/. So now I open up my web browser and insert the URL as either "localhost" or "127.0.0.1" (without quotes), I can see the Hello World page. Httpd is running fine. To test the PHP function, I created a phpinfo.php file inside the same directory with this value:

---- /var/www/htdocs/phpinfo.php start ----
<?php phpinfo(); ?>
---- /var/www/htdocs/phpinfo.php end ----

I open the URL "localhost/phpinfo.php" in my browser, the PHP Version page is displayed and I know PHP is working fine.


INSTALLING DRUPAL.
I just pkg_add drupal-7.32.p1. Then I read the info in /usr/local/share/doc/pkg-readmes/drupal-7.32p1 telling me to symlink (symbolic link) the drupal7.conf and follow the database setup for PostgreSQL which is:

ln -sf /var/www/conf/modules.sample/drupal7.conf /var/www/conf/modules

createuser -U postgres --pwprompt --no-superuser --createdb --no-createrole drupal
createdb -U drupal -E UTF8 drupal

The "postgres" name is my PostgreSQL's admin name. There will be input request for password so I create a password, verify it and make sure I don't forget it. For drupal7.conf, I haven't touch anything, yet.


SETTING UP DRUPAL.
Webserver running? Check. PostgreSQL running? Check. Drupal running? Not yet. I tried putting "localhost/drupal7" and "127.0.0.1/drupal7" in the browser but both didn't work. I got Error 403 Forbidden. Ouch. I'm seriously lack of experience for this httpd and drupal stuff so I thought that maybe I need to install either Apache or Nginx (assuming that nobody done drupal with httpd yet). That's until I read a hint in www.drupal.org. So, I insert this in my browser:

http://localhost/drupal7/install.php

And wallah!, the Drupal installation page appears!. Yes! It's making progress. So I proceed with the installation as below:

Choose profile = Standard > Save and continue
Choose language = English (built-in) > Sane and continue
Verify requirements = all is ok except for "Unicode library = Error"

7th August: Ok. The error is about a deprecated function in PHP which must be disabled for Drupal's installation to continue. Yeah quite confusing. The exact error is:

Unicode libraryError
Multibyte string input conversion in PHP is active and must be disabled. Check the php.ini mbstring.http_input setting. Please refer to the PHP mbstring documentationfor more information.

I opened the PHP mbstring documentation but nothing can help me on this. So I google for tips and found that there's 2 ways to resolve this.

1) Add this lines in .htaccess in Drupal's web root (/var/www/htdocs/drupal7)

---- .htacces start ----
php_value mbstring.http_input pass
php_value mbstring.http_output pass
---- .htaccess end ----

I checked the Drupal's web root, but there's no .htacces file inside. I think this is related to Apache but just to make sure, I downloaded a sample .htacces file from www.drupal.org . Restarted the httpd, open the installation page and still have that error. So this is not working for me.

2) Add this line in ../drupal7/sites/default/setting.php

---- setting.php start ----
ini_set('mbstring.http_input', 'pass');
ini_set('mbstring.http_output', 'pass');

---- setting.php end ----

Restarted the httpd. And open the installation page and greeted by this warning message:

  • Deprecated function: ini_set(): Use of mbstring.http_input is deprecated in include_once() (line 318 of /htdocs/drupal7/sites/default/settings.php).
  • Deprecated function: ini_set(): Use of mbstring.http_output is deprecated in include_once() (line 319 of /htdocs/drupal7/sites/default/settings.php).

When I click Save and continue, this message appears in every page. But then the Verify requirement page passed successfully (although the warning is still there). So I'm now at the Set up database page.

Set up database:
Database = PostgreSQL
Database name* = drupal (the one I set before in PostgreSQL)
Database username* = drupal
Database password* = (the password I entered back then in PostgreSQL)

But now I'm in dilemma. I don't know if that "Deprecated function:" warning is harmless or not. I think I will search for more clue before I click on that "Save and continue" button.

Update 9th August: Searching on the net point me out to the most relevant issue stated in drupal's site at:

https://www.drupal.org/node/2332295

There's patch files listed on the top of that page and the most relevant one is the file:

drupal7-unicode_requirements-2332295-23.patch

That file will be patching /includes/unicode.inc file in the root Drupal's folder. I read the patch file, and compared with the current unicode.inc file and found that this is the correct patch. Now to patch it.


PATCHING DRUPAL
I downloaded the patch file, and move it to Drupal's root folder at /var/www/htdocs/drupal7 . Patching is something I rarely do so I refresh what I can by using man patch.

I need to test the patch first, to see if it's working as it's supposed to be. So I proceed with the testing command:

# sudo patch -C includes/unicode.inc drupal7-unicode_requirements-2332295-23.patch

Then the result came:

---- message snipped ----
Patching file includes/unicode.inc using Plan A...
Hunk #1 succeeded at 116.
done

Looks fine to me. So then I proceed with the actual patching:

# sudo patch includes/unicode.inc drupal7-unicode_requirements-2332295-23.patch

Done. Now to test the Drupal's installation. Just remember to delete/comment back both the "ini_set" lines I added in sites/default/settings.php. Restarted httpd and proceed with installation again.

INSTALLATION.
- Get browser to open http://127.0.0.1/drupal7/install.php
- Choose profile > Standard > Save and continue = passed
- Choose language > English (built-in) > Save and continue = passed
- Verify requirements = passed
- Set up database
 > Database name = drupal
 > Database username = drupal
 > Database password = (same as when I set in PostgreSQL)
 > Save and continue

Got this error:

In order for Drupal to work, and to continue with the installation process, you must resolve all issues reported below. For more help with configuring your database server, see the installation handbook. If you are unsure what any of this means you should probably contact your hosting provider.
Failed to connect to your database server. The server reports the following message: SQLSTATE[08006] [7] could not translate host name "localhost" to address: no address associated with name.
  • Is the database server running?
  • Does the database exist, and have you entered the correct database name?
  • Have you entered the correct username and password?
  • Have you entered the correct database hostname?

Ok. I read that because httpd in OpenBSD is chrooted, I need to copy /etc/hosts and put it in /var/www/etc/. By default there's no etc/ folder in www so I need to mkdir it. Make sure that "hosts" file at least have this line:

127.0.0.1   localhost www.example.com

Now that should be it. Restarted httpd again and run throught the installation again.

- Set up database
 > blablabla
 > Save and continue = passed
- Install profile (it will take a moment = passed
- Configure site
 > Site name* = default
 > Site e-mail address* = noreply@example.com (can be changed)
 > Username = karl
 > E-mail address = (real email address)
 > Password* = *********
 > Confirm password* = *********
 > Default country = Malaysia
 > Default time zone = Asia/Kuala Lumpur
 > Check for updates automatically = checked
 > Received e-mail notifications = checked
 > Save and continue = FINISHED!

Congratulations, I installed Drupal. Now to visit my local site.

Unfortunately, currently I can't use http://127.0.0.1/drupal7/ to visit my site (which if my httpd configured correctly, should be the correct address) but I can visit the site by using complete URL instead.

http://127.0.0.1/drupal7/index.html

For Drupal, all seems ok. I need to further test out and start exploring. For httpd issue above, I will also do the same. I will update on these issues when I found any tips. Enjoy the screenshot. Later.


UPDATE!: Bah although Drupal has been installed successfully, it's not functioning as it should. I have a feeling it's related to OpenBSD's httpd's setting. I would be grateful if someone can point me to relevant setting for this issue. Thanks in advance.

Update 10th August: Ok I have configured the /etc/httpd.conf file and now Drupal is working fine. Here's my configuration:

---- /etc/httpd.conf start ----
ext_addr="*"

server "default" {
    listen on $ext_addr port 80

    directory {
        index "index.php"
    }

    location "*.php" {
        fastcgi socket "/run/php-fpm.sock"
    }

    location "/cgi-bin/*" {
        fastcgi
        root "/"
    }

    root "/htdocs/drupal7"
}
---- /etc/httpd.conf end ----

Restarted the httpd server. Now when I type www.example.com or 127.0.0.1 or localhost in my browser, I can see the Drupal start page. I typed my Username and Password then I can see the site correctly. No more errors.


I've also posted a Hello World! entry to test it out. Enjoy the screenshot. Later.

Thursday, May 28, 2015

5.7 amd64 X200: Rotating random wallpaper using feh + cron. And more.

Hi,

Searching for rotating wallpaper on the web has given me a few good shell scripts to use. But what if I just want to use the good ol' crontab and feh? Here's what I've done.

What I'm on now:
- CWM
- feh

Obviously CWM is my WM of choice nowadays. And I've installed feh. My lappy's screen resolution is 1280x800 so I went searching for beautiful nature's wallpaper. Get more than 2 so I'll have many rotation choices.

For me, I mkdir a Wallpapers folder. So it's look like:

~/Wallpapers

I put all the pictures into that folder. Now for the cron part.

$ crontab -e

This is my first cron so the file is empty. I want this wallpaper to rotate using random picture every 5 minutes. So my cron is like this:

*/5 * * * * DISPLAY=:0.0 feh --bg-fill -z --no-fehbg ~/Wallpapers/

In short, human-readable meaning is every 5 minutes (*/5) the screen (DISPLAY=:0.0) will be used by feh to fill the picture as wallpaper (--bg-fill) randomly (-z) without writing a ~/.fehbg file (--no-fehbg) using pictures from the folder ~/Wallpapers .

Then press :WQ to write the changes and quit so the process will start. Enjoy the rotating wallpapers guys.

Ok. Now. What if I want to use random wallpapers everytime I log in to cwm? The command is the same like crontab there but I need to ready 2 things.

Editing ~/.xsession and put this line (before exec cwm or any WM of your choice).

eval `cat ~/.fehbg`
exec cwm

Now create/edit ~/.fehbg and put the command like in crontab (without the DISPLAY=:0.0 bit):

feh --bg-fill -z --no-fehbg ~/Wallpapers/

And it's done. Oh wait, how about another one? Get a menu to change to a random wallpaper in cwm. Open up ~/.cwmrc and put this:

command ChangeWP "feh --bg-fill -z --no-fehbg ~/Wallpapers/"

Then refresh the cwm (by default should be pressing Ctrl+Alt+Shift+R) and click the menu.

Man crontab / feh for more info. Later.

Wednesday, May 27, 2015

5.7 amd64 X200: Downgraded back to 5.7-RELEASE but accidently clean installed.

Ouch,

This is one of those days. One of those days. I was having problem building libreoffice port in -current. Then found a latest snapshot, I upgraded to that latest snapshot but still having a problem building libreoffice. I didn't remember the exact error but it's related to GCC and lib-java or something similar.

I need to use libreoffice for my office works. So I thought on downgrading to 5.7-RELEASE. Downgraded I did. But failed miserably. I stupidly reinstall the -release. No. Cleanly installed. Yeah. I know. All my files are gone now.

My dotfiles, my data. Ouch. I mean a big OUCH. Yeah I know I should've kept my backup current. It's a stupid mistake on my side.

And now I will most probably start from (near) scratch. What I've learned?

1) Make sure the libreoffice is in packages for the -current version I want to upgrade as building libreoffice in port is a big pain in the butt.

2) Take backup seriously. I mean SERIOUSLY.

Later.

Tuesday, May 26, 2015

5.7 amd64 X200: New experiences

Hi,

This is what I noticed when I upgraded my X200 to 5.7. Take note that I don't have a lot of packages installed so my experience here is minimum.

TMUX:
mode-mouse no longer works. Documentation is saying that setting mouse on is enough now. Tried that but currently mouse not working as expected.
UPDATE: Previously when you scroll the mouse wheel, tmux will automatically scroll. Now you need to press ^B+[ (Ctrl+B [) then you can use the mouse wheel to scroll.

/etc/login.conf:
Now the datasize-cur has been upped in the default installation to 1536M. Great. Firefox and other memory hogging package rarely crash now.

Xombrero:
There's issue with /usr/local/lib/libestdc++.so.16.0 WARNING. Sometime Xombrero would crash and then starting the program will also coredump. After a few tries then Xombrero will run again.

There are others which I can't recall right now as I'm now on -CURRENT and using port to install Libreoffice. More on this later.

5.7 amd64 X200: Creating / Using Easy2Boot installer for OpenBSD

Hi,

OpenBSD 5.7 is out and what am I gonna wait for? Ok now I'm running 5.7-CURRENT using snapshot, newly upgraded from 5.7-RELEASE but more on that later. Right now I want to share another good way to install OpenBSD using USB Drive.

If you read my Creating USB Flashdrive post, you may notice that the previous way will create a flashdrive installer solely for OpenBSD. It's a good option for a small capacity flashdrive, or for a big capacity flashdrives, if you want to store your favourite packages in it. But what if you wanted to make a multi OS installer flashdrive?

Why I wanted to have a multiboot flashdrive? Well, OpenBSD is not perfect. There's something that OpenBSD lack that other OS have. It is wider packages availability. There's a time that I wanted to install something and it's not yet available in OpenBSD. Be it lack of porter's interest and/or lack of resources to port it, there's that time that I need to use the specific application. Heck the only minus point for OpenBSD to me is less packages than GNU/Linux. And then I sometime have that sort of need to test other *BSD OS or GNU/Linux distro. That's why.

After a brief comparison of tools that I need to use, I choose Easy2Boot. I'm not going to write in details about setting up Easy2Boot. You can check their website for instructions. It's fairly easy to setup Easy2Boot as the installer will take care of almost everything IIRC.

What OSes I wanna put in there?
1) OpenBSD (of course!)
2) FreeBSD
3) Ubuntu Linux
4) Maybe UBCD or other tools

Again, I won't write in details about other things than OpenBSD. As Easy2Boot is Linux-friendly, there will be no problem preparing Linux distro for Easy2Boot. As for FreeBSD, you can check out Easy2Boot for FreeBSD section.

For OpenBSD, I tried using install57.iso and the result is:
Booting - booting is ok. Can go through (U)pgrade option but then Easy2Boot cannot mount the ISO file correctly so I cannot install the packages contained in it.

What's the option? I need to use the minimum installation ISO = cd57.iso. Easy2Boot can take care of booting up the minimal ISO and I can run the installation/upgrade process. Take note that I'm using Windows to prepare this.

1)  Download cd57.iso from OpenBSD FTP site.
2) Rename the cd57.iso into some filename that easy to figure out. eg: OpenBSD57-AMD64.iso. Easy2Boot is very picky about "." (dot). Make sure to only have 1 dot only.
3) Move the ISO into the prepared Easy2Boot flashdrive:
/_ISO/MAINMENU/
4) Run the /MAKE_THIS_DRIVE_CONTIGUOUS.cmd inside the root folder of the flashdrive.

Ok the booting part is done. As the ISO is just a minimal boot, I need to get the base packages ready.

1) Go to the root flashdrive. eg: /
2) Create 5.7/amd64/ folder.
3) FTP into OpenBSD FTP site to download the base packages. For -RELEASE, it's ftp.openbsd.org/pub/OpenBSD/5.7/amd64/ .
4) Download all the bsd* , *tgz and optionally-but-recommended SHA256* files into the /5.7/amd64/ inside the flashdrive.

Done. Now, this method is more like the usual installation method, right? And who said that OpenBSD is hard?

For installation:
1) After Easy2Boot is booted, choose your OpenBSD ISO to boot OpenBSD image and do (U)pgrade.
2) When the installer ask for the packages, choose disk, then choose not mounted, and then choose sd1i (depending on your system).
3) Point your installer to the directory 5.7/amd64 inside the mounted sd1i.
4) If you created the folder correctly and put the files in there, the installer should list all the files needed to do the installation/upgrade.
5) Install/Upgrade!

Let the installation continues and reboot. After reboot, do sysmerge, the usual stuff. Starting from 5.7, the etcXX.tgz and xetcXX.tgz is now in base. So the sysmerge command is much simpler now.

# sysmerge

That's it. I've tried installing both OpenBSD and Ubuntu Linux using Easy2Boot and so far it's great. I haven't tried FreeBSD though. I hope you will find this useful. Later then.

Saturday, April 11, 2015

5.6 AMD64 X200: Tryton ERP, "no module named stdnum" error when installing "bank" module.

Hey,

I'm currently trying out Tryton ERP, a fork of OpenERP which is now known as Odoo ERP. Both are open-source, although some would differ on which is more open-source than the other.

Anyway, I have a test "server" in my office now, although not much of a server as it's just an Intel Atom netbook but sufficient for my testing usage. Its role? Well I want it to be a testbed for database server, probably an ERP/CRM/HRM server the company I work at can use.

In that "server", I have Odoo installed. And in my lappy, I have Tryton installed. I like how Odoo (v8) have (in my opinion) a mature web ui, which currently Tryton don't (yes I know tryton have SAO). But that is somewhat a plus-point because I want the staff to use the web ui. Also Odoo's module can be installed via their web ui. Then their HR app is good.

Why didn't I install Odoo in my laptop too? Well, because Tryton is a fork of the same base ERP, and then Tryton is already in OpenBSD's package. Also there's quite convincing arguement from Tryton's dev on why their program is better (in term of coding, stability, security) from Odoo (or OpenERP as I read the comparison between Tryton vs Odoo/OpenERP v7 only). But Tryton's module installation is quite a hassle as you need to do pkg_add then import the installed module using trytond -i all -d "dbname".

Speaking of which, I was trying out some of the modules available for Tryton. I was a bit frustrated when on OpenBSD there's no trytond-module-all module so I can install all available module just in 1 go; but then this have it merits as I stumbled on an issue while installing the "trytond-module-bank" module.

pkg_add trytond-module-bank installation went fine. The problem arose when I tried to import the module using trytond -i all -d tryton32 (take note "tryton32" is my database name). I received this error message:

$ no module named stdnum

After searching for answer, I found that this module (trytond-module-bank) requires a python module called "python-stdnum" which is not the OpenBSD's package system. So I search for it using "pip".

$ sudo pip search stdnum

And there it is. "python-stdnum" module sitting there waiting for me to install it. And that's what I did.

$ sudo pip install python-stdnum

Installation went ok. Good. Then I proceed with importing the module in Tryton.

$ sudo trytond -i all -d tryton32

Success! Now I can continue experimenting with this great software.

Oh another thing. In /etc/trytond.conf, take note for these settings:

jsonrpc = localhost:8000

Make sure that if you're using Tryton client, the "hostname" is set to localhost, not the local IP Address (127.0.0.1) because I've done that and it won't connect.

Later then.

6.5 amd64: Modify existing certbot certificates.

Hi, It's been quite some time eh. As you can see, I still upgrade my OpenBSD system regularly but currently I do not have the time to ...