Ubuntu 7.10, Setting up / Installing SSH Access, Apache2, Mod Rewrite, HTTPS / SSL Certificate, MySQL 5, PHP 5, XSL, XSLT, PDO, ImageMagick (Imagick)

Apache, General News, Trips and Photos, php, ubuntu No Comments »

This document Contains information about Installing Ubuntu, Setting up / Configuring: SSH Acces, Apache2, HTTPS, MySQL5, PHP5, XSL / XSLT, Imagick, PDO and Home networking (Although not complete !!)

Ubuntu 7.10, From Installation to Complete Setup - An Idiots guide

Information Covered..

  • Initial and Essential Configuration
    • Install
    • Pre Use / Screen Setup
    • Update / Upgrade your new installation
    • Setup SSH Acess
  • Setting up the Web Dev Environment
    • Setup Apache2
    • Setup HTTPS / SSL Cert
    • Setup MySQL 5
    • Setup PHP 5
      • Enable XSL / XSLT support
      • Enable Imagick (Image manipulation library
      • Install PDO
  • Setting up the home network (SSHFS and NTFS)
    • Installing the Samba Server
    • Connect your Win box to Ubuntu Box

Wordpress’ code is shit… so please read this blog entry / ubuntu how-to on this plain html page.
Click here to read more.

php5-mysql mixed with pdo and pdo_mysql causes apache to failed to load.

Apache, php, ubuntu 5 Comments »

I am running ubuntu 7.10

I had previously installed php with pdo, and added the pdo_mysql and pdo
extension into the /etc/php5/apache2/php.ini file.

Once i then tried to install php5-mysql via apt-get php segfaulted and
apache refused to restart.

With the pdo and pdo_mysql extension in php.ini i was getting the
following error from /var/log/apache2/error.log..

PHP Warning:  Module ‘PDO’ already loaded in Unknown on line 0
PHP Warning:  Module ‘pdo_mysql’ already loaded in Unknown on line 0
/usr/sbin/apache2: symbol lookup error: /usr/lib/php5/20060613
+lfs/pdo_mysql.so: undefined symbol: php_pdo_get_dbh_ce

Once i commented out the pdo extension, this got rid of the first PHP
warning, and pdo is in phpinfo but no pdo drivers..

If i comment out pdo_mysql in /etc/php5/apache2/php.ini and also
commented it out from /etc/php5/conf.d/pdo_mysql.ini and restarted
apache then it worked.

Bottom line is, if anywhere at all you have pdo_mysql.so in any
configuration, you get the error:

/usr/sbin/apache2: symbol lookup error: /usr/lib/php5/20060613
+lfs/pdo_mysql.so: undefined symbol: php_pdo_get_dbh_ce

and apache fails to load.

Server version: Apache/2.2.4 (Ubuntu)

My Ubuntu 7.10 Setup - Initial setup, Look & Feel, Web dev environment

Apache, General News, php, ubuntu No Comments »

Hello anyone reading, i recently setup my ubuntu 7.10 (Which I’m absoloutley convinced is slower than 7.04) and anyway, here is a few notes from my installation, i hope someone finds some part of it useful. If so.. please comment…

There are 3 main sections:


Step 1, initial setup

Hello, this is my guide to setting up my ubuntu dev machine.

Here is my PC setup:

  • PC: Dell INSPIRON 530
  • Monitor: LG Flatron Wide M228WA

Issues with the INSPIRON 530 from previous ubuntu installations..

I have reinstalled ubuntu many times on the Dell INSPIRON 530, and have encountered a few issues in the past. I will detail them below.

Help, No ethernet !!

Prior to Ubuntu 7.10, if you installed ubuntu on your Dell INSPIRON box, you will find the ethernet on the back is not supported out of the box. To get the ethernet installed, please untar the following archive..

firstly do: wget theatons.com/test/dump/linux-backports-modules_2.6.20-16.tar.gz
then extract: tar xzvf linux-backports-modules_2.6.20-16.tar.gz
then run: sudo dpkg -i linux-backports-modules-generic_2.6.20.16.28.1_i386.deb

You might have to run the other one aswell, in some kind of order, but it makes no harm to just play about running those and then plug in your ethernet, give it 1-2mins to sort it self out, then run ifconfig and you should see your ip having connected via your ethernet.

Incidently the ethernet for the Dell INSPIRON 530 on ubuntu 7.10 works out the box

What about my Dell E228WFP ?

Well i know when i installed with ubuntu 7.04 it only went up to 1024 res out the box, however the correct xorg.conf and guide to getting this to 1680x on my other post here: Setting up the E228WFP with ubuntu.

I don’t know how this is with ubuntu 7.10 as i said i’m now using a LG Flatron Wide M228WA, which incidently is as much more superiour monitor, and works with ubuntu 7.10 out the box at 1680x resolution.


Step 2, personal preferences

Lets get it looking a little better so we can work on it properly..

Big fonts look ugly.

I highly recommend taking down the font-size from the standard ubuntu font-size of 10px to 8’s and 9’s.

Todo this go to ‘System’ -> ‘Preferences’ -> ‘Appearances’ -> ‘Fonts’ and then i use, in this order:

  • Application font: 8
  • Document font: 8
  • Desktop font: 8
  • Window title font: 9
  • Fixed width font: 9

And keeping the font itself standard feels fine. I also set it to ‘Subpixel smoothing (LCDs)’ but this is all personal preference really.

Getting a start like, ‘windows’ menu…

If your coming from a Windows background, as i’m sure 90% of people are, i recommend a nice easy start style menu, again, all personal preference..

I do the following..

  • Add a panel to the top menu, ‘Window list’
  • Unlock the top menu and then add into it the ‘Workspace switcher’, ‘Deleted Items’ and ‘Show Desktop’
  • Finally ‘Delete’ the bottom pannel, then drag the top pannel to the bottom.


Step 3, Setting up the ultimate webdev environment

What am i talking about ? Just installing the things everyone needs to get along in this web dev mad world !

  • Apache 2
  • MySQL 5
  • PHP 5
  • phpmyadmin
  • SSL certificate
  • mod_rewrite
  • PDO and PDO_Mysql
  • Imagemagick

Think i’ve missed somthing of the list ? No problem, drop me a comment and i’ll stick it on

Installing the major players, Apache2, MySQL 5, PHP 5, PhpMyAdmin, SSL, Morewrite, PDO and PDO_MYSQL…

I’m not going to bother rewriting all this up, as comprehensive instructions can be found on my previous post, by clicking here

Please note, if you intend on sending requests via CURL from https, when u will need to fix this error: CAfile: /etc/ssl/certs/ca-certificates.crt
Todo this you simply need to type the following: sudo apt-get install ca-certificates

Want to know how to install Imagemagick on ubuntu ?

No problem if you want to install imagemagick on your pc, ubuntu makes this very easy for you with only a few simple commands..

  • Make sure u have pear install ( ’sudo apt-get install php-pear’ )
  • Then run: sudo apt-get install imagemagick
  • And then: sudo pecl install imagick
    **if you get an error which looks like this: configure: error: Cannot locate configuration program Wand-config
    then no problem, simply run the following command: sudo apt-get install libmagick9-dev
    Now re-run sudo pecl install imagick

All sorted ? Good, now simply add extension=imagick.so to your php.ini and your done :)

Incidently, if you want to get serious about PHP and Imagemagick, i highly recommend you check out mikko’s imagemagick blog which details lots of examples of using imagemagick and pushing it to the limit. cool stuff.

I want my php to send emails aswell

If you need your php - dev environment to also send emails, simply install any kind of mail program, i use postfix.. sudo apt-get install postifx

Simply select ‘internet site’ if your unsure, make sure you put the mail server name NOT as your @domain.com email, as this will be treated as internal, and not sent via the web. a good server name might be: MyDevBox for example.

What about vim ? And syntax highlighting .. etc ?

Simply type: sudo apt-get install vim-full

Then cd ~/ to get to your homedirectory, then vim .vimrc and put in whatever settings you would like, eg: “syntax enable”. .. you may find some idea’s on the net from other peoples .vimrc files.. have fun :)

I have also put my personal .vimrc file online which can be found here: My .vimrc file / Vim setup file

My .vimrc Config file

Apache, General News, php, ubuntu No Comments »

Hello, This is how i like my .vimrc file :)

” Enable syntax highlighting
syntax enable

” Map F8 with next tab, and F7 with previous tab
map :tabn
map :tabp

” Make sure backspace always works
set backspace=2

” Autoindent
set autoindent

For those of you who are still running vim < 7 i recommend you update purely for the tabs. Although previous versions had a :next and :prev the new tabs along the top just seems to make work much easier.

I also highly recommend checking out the vim documentation, available at this link: Vim Documentation and also check out this for some cool tutorials and links Vim Resources

Apache2, Allowing from Only your Localhost, Specific Ips and Redirecting for others

Apache, ubuntu No Comments »

What i wanted

I have a server in the office, and wanted all people on the network to be able to access the webservers root path (/var/www/) but all external ip’s to be redirected to /var/www/some/other/dir

htaccess file

My wordpress will not let me write “dot htaccess”, so where you see me say “htaccess”, please put a “.” (dot) infront of it.

How todo it

Firstly with mod_rewrite

If you don’t have access to your /etc/apache2/sites-available files or are on a shared host, then this can be done entirely from your htaccess file, HOWEVER %{HTTP_ .. can be spoofed, so is not entirely secure.

Firstly lets put the htaccess in place in the root directory of our web server (/var/www/)

sudo vim /var/www/htaccess

And in here we need to add the following code:

RewriteEngine on
RewriteCond %{HTTP_HOST} !^localhost
RewriteCond %{HTTP_HOST} !^192\.168\.
RewriteRule (.*) /some/other/folder/ [L]

That should all be pretty self explanatory, but if not, explanation as follows:

  • RewriteEngine on - Enable mod_rewrite
  • RewriteCond %{HTTP_HOST} !^localhost - If the host is not localhost
  • RewriteCond %{HTTP_HOST} !^ 192\.168\. - If the ip is not in the 192.168 range
  • RewriteRule (.*) /some/other/folder/ [L] - Redirect all requests, HEAD, GET, POST to the /some/other/folder directory, the [L] flag stops processing

More information on mod_rewrite can be found at the following pages

Secondly, secure with apaches sites-available file

Firstly, we need to open your sites configuration file (default, or ssl, or mysite perhaps).. mine is called ‘default’

cd /etc/apache2/sites-available/
sudo gedit default

We then need to add in the correct allow from. More documentation on this can be found here: Apache2 Allow From Documentation

I wanted allow 192.168 & localhost to be able to view /var/www/, but give everyone else access /var/www/some/other/folder/

This is how i edited my default file accordingly.

<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from 192.168
allow from localhost
</Directory>
<Directory /var/www/some/other/folder/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
</Directory>

Again this should all be self explanatory. If not, reread it.

Conclusion

I’m sure there’s 100 and 1 ways todo this, some possibly more complicated, and others maybe more simple. Please post links to other useful similair tutorials, comments on security, improvements are all welcome.
I am glad to share the knowledge i have learned with other people to save them wasting their time re-learning what i have already found out :)

WP Theme & Icons by N.Design Studio & Shamefully P0wered by WordPress
Entries RSS Comments RSS Log in