Showing posts with label Installation. Show all posts
Showing posts with label Installation. Show all posts

Thursday, May 12, 2016

-c amd64 X200: Installation for Drupal 8.

Hi,

It's been quite some time. I'm busy with day's work. Ah and also my X200's battery just died. So it's immobile. It's just docked and that's it. Replacement battery or "new" thinkpad (I always buy used anyway.), I'm not sure. But not now.

Ok back to the latest project/test I'm going to do. Drupal 8 has been released, I know I'm a bit late, and it's an interesting update. So I really want to install it. Take note that I'm installing this, after I installed Drupal 7. So nearly all of the dependencies are already there. You might want to (re)visit my previous post on this at http://karlbsd.blogspot.my/2015/08/openbsd-58-c-amd64-httpd-postgresql.html.

Recap, this is httpd + Drupal 8 + PostgreSQL.

1) Download Drupal 8.
I head over to http://www.drupal.org and download the latest stable version 8.1.1 which is drupal-8.1.1.tar.gz.

2) Extract file and move to htdocs.
I tar the downloaded drupal-8.1.1.tar.gz and rename the directory to drupal8 while moving it to /var/www/htdocs.

$ tar zxvf drupal-8.1.1.tar.gz
$ mv drupal-8.1.1 /var/www/htdocs/drupal8

3) Prepare the local hostname.
This Drupal, like the previous version, will only be a local testing environment. I also have a few *.example.com sites here, a plain php site, some drupal 7 site so I need to have another local hostname. I'm choosing drupal.example.com as my Drupal 7 site will now have drupal7.example.com instead. For that, I edited 2 files, /etc/hosts and /etc/httpd.conf.

$ vi /etc/hosts

===== /etc/hosts starts =====
127.0.0.1    drupal.example.com
===== /etc/hosts ends =====

$ vi /etc/httpd.conf

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

    directory {
        index "index.php"
    }

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

    root "/htdocs/drupal8"
}
===== /etc/httpd.conf ends =====

4) Drupal 8 installation.
Now is the good stuff. After I restart (restarting httpd is also ok), I fire up my browser and type "drupal.example.org" and Drupal 8 installation page is displayed. Nice!.


At the Choose language page, I just choose the default English and click Save and continue.

Choose profile, I choose Standard and click Save and continue.

Verify requirements, I was shown a warning and 2 errors. I'll show what I've done to resolve the warning/errors.

PHP OPcode cachingNot enabled
PHP OPcode caching can improve your site's performance considerably. It ishighly recommended to haveOPcache installed on your server.

In OpenBSD 5.8 and newer, and -Current, the opcache.so is readily available. It's just that it's not included in /etc/php-5.6.ini. So I edited /etc/php-5.6.ini. My changes is in bold.

===== /etc/php-5.6.ini starts =====
* other sections skipped *

engine = On

* other sections skipped *

; zend.script_encoding =

; This is for Drupal 8
zend_extension=/usr/local/lib/php-5.6/modules/opcache.so

===== /etc/php-5.6.ini ends =====

And after restarting, the warning is gone.


File systemWritable (public download method)
The directory sites/default/files does not exist. An automated attempt to create this directory failed, possibly due to a permissions problem. To proceed with the installation, either create the directory and modify its permissions manually or ensure that the installer has the permissions to create it automatically. For more information, see INSTALL.txt or the online handbook.
For this one, it's just that I create a files directory inside /sites/default. Then I chown the directory to www:www.

$ cd /var/www/htdocs/drupal8/sites/default
$ mkdir files
$ chown www:www files


Settings fileThe Settings file does not exist.
The Drupal installer requires that you create a ./sites/default/settings.php as part of the installation process. Copy the./sites/default/default.settings.php file to./sites/default/settings.php. More details about installing Drupal are available inINSTALL.txt.
This error is telling me that I haven't edited a settings.php file yet. So I need to copy the default.settings.php file to settings.php file.

$ cd /var/www/htdocs/drupal8/sites/default
$ cp default.settings.php settings.php
$ vi settings.php

===== settings.php starts =====
* other sections skipped *

/ **
* Database settings
* bla bla bla
*/
$database['default']['default'] = array(
    'driver' => 'pgsql',
    'database' => 'drupal',
    'username' => 'drupal',
    'password' => 'mypassword',
    'host' => 'localhost',
    'prefix' => '',
);

* other sections skipped *
===== settings.php ends =====

Take note that I have an existing Drupal 7 installation using the same database information. Exactly the same setting.

Then I click "try again" link at the bottom of the page.

Then the Database configuration page opens up.

Database configuration

Database type
 
 


I key in my Database password, then click Save and continue. Then I received an error stating that Drupal already been installed. Sheesh.

I dropped the previous drupal database in PostgreSQL, keeping the drupal username. Then I createdb a new drupal database. Please check your INSTALL.pgsql.txt file for details. Also I deleted the settings.php and copy default.settings.php to settings.php without changing anything. Just making sure the file is read/writable.

Then I restarted the Drupal installation again, and the installation went through.


On the configuration page, I just put the needed info and click Save and continue.

Drupal proceed to install. And after installing I can see the main page. Yeah!. Being amazed, I clicked on Content to start exploring and.. Error 404, Page not found. Ouch. Every other links gave the same error.

So I search the trusty-ol-internet, and found that this is related to Clean URL and mod_rewrite which unfortunately, users of OpenBSD's httpd can't use right now. Ouch. Again. I'm searching for anything relevant, maybe I'll try to disable the Clean URL thingy. But for now, I do know that Drupal 8 installation can go through. Later.

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.

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.

Monday, November 21, 2011

5.0 amd64 K43U: Dual booting OpenBSD 5.0 AMD64 with Windows 7 x64.

Hi,

Ok. Now's the time some of us has been waiting for. I'll write up the experiences in configuring dual-boot environment of OpenBSD 5.0 AMD64 and Windows 7 x64 on my Asus K43U AMD Vision's laptop. I might write this in parts, or even put it all in this 1 posting.

Previously I wrote a bit about my K43U laptop and a bit about the specification. I have a large hard disk, 500Gb so I made my mind to dual boot this laptop with OpenBSD 5.0 AMD64 and Windows 7 x64. OpenBSD will be my work environment, and Windows 7 will be for gaming stuff. Now on to the experience.

1) Preparations
Ok first of all, install Windows first. On my K34U, I have 3 partition on my 500Gb drive. The first partition is Windows's reserved for something that I don't know of, whatever to make the OS happy. Then the 2nd partition is for Windows 7. The 3rd partition is for OpenBSD 5.0 AMD64. Make sure the important files in Windows 7 is properly backed up, as I've learned on the hardest way possible. More on this in a moment. Here's how I divide the hard disk.

None = System Reserved = 100Mb
C: = Windows 7 = 270Gb
None = OpenBSD 5.0 AMD64 = 195Gb

After hours of installation and updating Windows 7's driver to make it workable, my Windows 7 environment is installed. I used MS's Computer Management > Disk Management to create the free space for the would be OpenBSD into a raw partition without any filesystem format inside.

With the OpenBSD's CD inside, I rebooted the machine and for K43U, I need to press [ESC] key during the ASUS logo to choose the boot device. Then I choose my DVD drive to boot the OpenBSD CD. Then the lovely OpenBSD boot screen appears.

OpenBSD then asked me to choose either to (R)epair, (I)nstall or (U)pgrade, I choose [I] for installation.

After that the setups for root user/pass, configuring re0 for network and adding another user for the system. It's all the easy parts.

Then OpenBSD asked me to either "use the (W)hole disk or (E)dit the partition". It's the fdisk *gasp*. I just remembered and my last dual-boot exercise is on FreeBSD which is a long time ago! Ah. People says that curiosity kills the cat and mine killed my Windows 7 partition as I thought pressing [W] will give me a preview and there will be a confirmation afterwards asking me to confirm to use the whole hard disk. Well remember this well people. IT DOES NOT!. Once you hit the [W] key, OpenBSD will proceed with rewriting the MBR and it will be nearly impossible to recover your Windows installation. Well some said it's nearly impossible, but me, I never managed to get it back! I had to reinstall Windows 7 and start again. So do keep this in mind.

So I carefully hit the [E] key (remember next to the [E] key is... the [W]!!) so I can edit the partition manually. Here's a bit of it. Bold text is my input:

fdisk:1> e 2
fdisk:1> A6
fdisk:*1> q

So basically I told fdisk to use the 3rd slice (partition) of the hard disk (remember in *nix numbers starts with 0, not 1) and it's labeled as 2. OpenBSD needs A6 as the filesystem type so I set it. Then I just press [Q] to save changes and exit fdisk. Some pointer on the net stating that pressing [W] to write the changes in MBR is needed but I didn't do that. I might make you happier but currently this minimum steps are working fine for me.

After that, my partitions look like this:



Take note that the "*" sign on partition 0 means that I didn't make the new OpenBSD partition as active partition and retain Windows 7 partition as bootable. Well, this is because I'll be using Windows 7's own boot manager for dual booting. No need to install other boot manager software.

Now to partition the OpenBSD slice (Partition? Slices?). As usual, I starts with auto to see roughly how OpenBSD will partition my OpenBSD. And then I revert back to zero and do it manually. So I come up with this:

/ = 1Gb
swap = 2Gb
/var = 7Gb
/tmp = 4Gb
/usr = 18Gb
/home = the rest


Yours might be different so adjust it accordingly. I still think my swap is too big but as I have a bigger hard disk now, it doesn't matter much. Then proceed with OpenBSD installation. It took a while but no problem on the installation. Great.


2) Dual-boot preparation.

So the OpenBSD 5.0 amd64 has been installed. Before I reboot the machine, it's best to refer to http://www.openbsd.org/faq/faq4.html#Multibooting.

I proceed with creating the OpenBSD Partition Boot Record using the OpenBSD page for reference.

# dd if=/dev/rsd0a of=openbsd.pbr bs=512 count=1

After that I put my fat32 usb thumbdrive and copy the file "openbsd.pbr" into it.

Before rebooting, I changed the timezone so that the time in OpenBSD don't go off by 8 hours (Malaysian time). Text in bold is mine.

$ sudo config -ef /bsd
OpenBSD 5.0 (GENERIC.MP) #63: Wed Aug 17 10:14:30 MDT 2011
$nbsp;$nbsp;$nbsp;$nbsp;deraadt@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
Enter 'help' for information
ukc> timezone -480
timezone = -480, dst = 0
ukc> quit
Saving modified kernel.


How did I get the "-480"? Because Malaysian time is +8 to UTC. So why was it -480? 8 x 60 mins = 480 mins. Because we're 8 hours in advance from UTC, we need to deduct the timezone about 480 minutes. Yours might be different so do make sure of it. dst is Daylight Saving Time which we don't use so it's 0. Oh yeah, make sure visudo is done appropriately so that we can sudo.


3) Configuring Windows 7 x64 to dual-boot.

Ok remember when I didn't change the active partition on fdisk back then? It's because we're going to reboot and let Windows 7 as the default boot (not for long though). I'll be using W7's own boot manager to dual boot OpenBSD amd64 and Windows 7 x64. As before, it's best to refer to OpenBSD's page on multibooting because I do.

Inside Windows 7, I moved the openbsd.pbr from my thumbdrive to C:\. Then I opened cmd (MS command prompt) as Administrator. Inside it, I typed the following. Bold text is mine and TAKE NOTE! I copied this from OpenBSD's page because there are details I didn't save.

C:\Windows\system32> bcdedit /create /d "OpenBSD/i386" /application bootsector
The entry {0154a872-3d41-11de-bd67-a7060316bbb1} was successfully created.

C:\Windows\system32> bcdedit /set {0154a872-3d41-11de-bd67-a7060316bbb1} device boot
The operation completed successfully.

C:\Windows\system32> bcdedit /set {0154a872-3d41-11de-bd67-a7060316bbb1} path \openbsd.pbr
The operation completed successfully.

C:\Windows\system32> bcdedit /set {0154a872-3d41-11de-bd67-a7060316bbb1} device partition=c:
The operation completed successfully.

C:\Windows\system32> bcdedit /displayorder {0154a872-3d41-11de-bd67-7060316bbb1} /addlast
The operation completed successfully.

C:\Windows\system32>



See the text in underline? That thing depends on your system. I didn't save what's mine so I copied from OpenBSD's page. Yours will be different so do take note of that. Now the machine has been configured to dual-boot between OpenBSD 5.0 amd64 and Windows 7 x64. The Windows 7 boot manager can be tweak.

That's all. I might be updating this post to reflect any other things I forgot to mention etc. Enjoy and later!

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 ...