Tech stuff and info dump

Changing MySQL root password (using phpMyAdmin, Ubuntu linux)

May 13th, 2010

If you have phpMyAdmin installed, it can be used to change the MySQL root password. (If you don’t have phpMyAdmin installed, there are installation instructions in this post.)

  1. Log in to phpMyAdmin. (If you have phpMyAdmin set up as described in this post, log in to phpMyAdmin by opening a web browser like Firefox and entering http://localhost/phpmyadmin/ as the URL.)
  2. Click on the ‘Privileges’ tab to view a list of all Users.
  3. Click the little pencil icon in the rightmost column of each ‘root’ account.
  4. Enter a password in appropriate field of the newly-loaded page.

Filed under: mysql,php,phpmyadmin
May 13th, 2010 13:11:13

Ubuntu 10.04 (Lucid Lynx): simple, step-by-step lamp server installation (linux, apache, mysql, php)

May 13th, 2010

Well, today’s the day for installing a lamp server on my 10.04 machine! Wireless is working just well enough that I’ve not given up and gone running back to 9.04, although there are still some mysteries to figure out where that’s concerned.

It’s worth noting that I’m setting up my server for personal use. I want something that will let me test out webpages that will hosted by other people’s servers. (If you’re setting up an internet-facing server, these instructions will get you started, but more work is needed to keep the server safe from the wild world of the internet. If I come across a good tutorial on such things, I’ll post it.)

Downloading Necessary Packages

Synaptic Package Manager can be opened by going here:

System -> Administration -> Synaptic Package Manager

and entering one’s password.

I used Synaptic Package Manager to download the following packages:

  • php5 (this installs apache2-mpm-prefork, etc.)
  • mysql-server-5.1 (this installs the client and core as well)
  • Optional: phpMyAdmin (a nice GUI for managing MySQL tables)
  • Optional: php5-cli (only needed if you want to run PHP from the command line)

The packages can be found by clicking the Search icon and typing in the package names. When a package name is selected, Synaptic Package Manager kindly prompts one to install all other files required. Once you have chosen all the packages needed, click ‘Apply’ (underneath the green check mark) at the top of the Synaptic Package Manager window.

File Installation

For the most part, Synaptic Package Manager will take care of all the installation. There are a couple things that might need to be done manually, however.

Configuring phpMyAdmin

If you have chosen to install phpMyAdmin, you may get a pop-up window called ‘Configuring phpmyadmin’ with the text “Web server to reconfigure automatically:” and a choice of servers. This is just asking which server you want to be able to run phpMyAdmin. I was given the choice of apache2 and lighttpd. I ticked apache2 and clicked the ‘Forward’ button.

Configuring MySQL

The mysql installation also requires some information. A pop-up window called ‘Configuring mysql-server-5.’ should pop up with the text ‘New password for the MySQL “root” user:’ and a text box.

Make up a password for the root user and enter it into this box. (Write it down – you’ll need it later!) Click ‘Forward’. You’ll be asked to re-enter the password. Do so, and click ‘Forward’ again.

Database for phpMyAdmin

If you’ve chosen to install phpMyAdmin, you’ll get another ‘Configuring phpmyadmin’ pop-up with the text ‘Configure database for phpmyadmin with dbconfig-common?’ and a tickbox. I left this ticked; clicking ‘Help’ explains under what circumstances one wouldn’t want this to happen. Once the selection is made, click ‘Forward’ to continue.

If the box was ticked, you are then prompted for “Password of the database’s administrative user:” and given another text box. Use the MySQL root password that you just made up.

After this, the installation should complete itself without any more human help.

Restarting the Apache server

Before anything can be done, the Apache server will need to be restarted.

Open a terminal (Applications -> Accessories -> Terminal) and, at the command line, type:

sudo apache2ctl restart

The first time I did this, I received this warning:

apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName

This went away when I did this:

Letting Apache know about localhost

Open a terminal (Applications -> Accessories -> Terminal) and, at the command line, type:

sudo gedit /etc/apache2/apache2.conf

The sudo command gives you root-like powers (needed here to edit this particular file), gedit opens the notepad-like application, and /etc/apache2/apache2.conf is the name of the file being edited.

(If prompted for a password, use the password that is used to log in to Ubuntu.)

This should open a notepad-like window with a lot of stuff.

I added

ServerName localhost

as a separate line at the end of the file and saved the document (File -> Save in gedit).

After saving, restart Apache again by typing

sudo apache2ctl restart

at the command line.

Testing to make sure PHP works

Open a terminal window by going to

Applications -> Accessories -> Terminal

Type this (pressing enter when finished) at the command line:

cd /var/www/

This takes you to the /var/www folder. Then type:

sudo gedit

and press enter. You’ll be prompted for your system password (the one used to log in to Ubuntu). (The ‘gedit’ opens a notepad application; the ‘sudo’ is necessary because if gives you root-like powers which are needed to save a file in the /var/www folder.)

In the notepad application that should have popped up, type the following:

# test.php
<?
phpinfo();
?>

Then go to File -> Save As and enter test.php as the name of the file.

Open a browser (like, say, Firefox at Applications -> Internet -> Firefox Web Browser) and type

http://localhost/test.php

and you should get a page come up with all sorts of useful and interesting information about your Apache server! It works!

(If you get a page that just says “# test.php” then Apache doesn’t know about localhost. Try editing /etc/apache2/apache2.conf and restarting the Apache server as described above.)

Setting up phpMyAdmin

If you’ve opted for phpMyAdmin, there is one quick little thing to do to make it work.

Open a terminal window (Applications -> Accessories -> Terminal) and type:

sudo gedit /etc/apache2/apache2.conf

at the command line prompt. If prompted for a password, use the password for logging in to Ubuntu.

Add this line to the file that has been opened in the notepad-like window:

Include /etc/phpmyadmin/apache.conf

Make sure this is on a line of its own. Save the file (File -> Save), close the gedit window and restart Apache by typing:

sudo apache2ctl restart

at the command line prompt.

Check to make sure phpMyAdmin works

Open your favourite web browser (say, Firefox) and navigate to:

http://localhost/phpmyadmin/

This should bring up a login screen. You can log in to phpMyAdmin by using ‘root’ as the username and the mysql root password set during installation.

The mysql root password can be changed in phpMyAdmin by going to the privilege page and clicking the pencil icon next to each root account. Enter a password in appropriate field of the newly-loaded page.

Once logged in, you can use phpMyAdmin to manage your MySQL databases.

Where Important Things Are

Here’s where to find useful stuff.

The Apache configuration file is located at:

/etc/apache2/apache2.conf

The default web folder is here:

/var/www

Apache error logs are here:

h1

If anything goes horribly wrong, reading these can often be very helpful. (Even if what’s written in the file makes no sense, it’s often quite easy to pop the error message or warning into Google. Very often, there’s someone talking about the problem using real words in the first page of hits.)

Apache access logs live here:

/var/log/apache2/access.log

NB: Both etc and var can be found two levels ‘up’ from the home folder.


Filed under: apache,lamp server,mysql,php,Ubuntu 10.04
May 13th, 2010 12:54:28

Firefox 3.6.3: make new tabs open at the far right, at the end of the list of tabs

May 13th, 2010

When I uo Ubuntu 10.04, I also ended up with Firefox 3.6.3. This was all fine and dandy apart from one thing: when I right-clicked a link and selected ‘New Tab’, the new tab would come into being right next to the current tab, not at the end of my (usually long) list of tabs. Because I often open multiple tabs at once and prefer to read them left-to-right, I wanted to change this behaviour back to what it was in earlier versions of Firefox.

Here’s how it can be done….

In the window where URLs normally go, type the following:

about:config

Unless you’ve already done this and have unticked the button that says ‘Show this warning next time’, A page will lode with the title ‘Here there be dragons!’ and a warning message.

about-config

Click the button that says ‘I’ll be careful, I promise!’ to get to a page with a zillion options.

You can search via keyword by typing a word into the ‘Filter’ box. For example, if you type ‘tab’ in the Filter box, one of the items that appears in the ‘Preference Name’ column is

browser.tabs.insertRelatedAfterCurrent

Right click on this option and click ‘toggle’ to change the value from ‘true’ to ‘false’ if you want a newly opened tab to appear at the end of your list of tabs.

Mozilla has a handy page with information about some of the preferences that appear in about:config and links to pages that cover other about:config options.


Filed under: Customisation,Firefox
Tags: ,
May 13th, 2010 00:54:12

Ubuntu linux: using dmesg to find bootup messages

May 12th, 2010

To view your bootup messages, open a terminal (Applications -> Accessories -> Terminal in Ubuntu 10.04 etc.) and type:

dmesg

There can be a lot of information, so I like to use less to navigate through the message:

dmesg | less

(Use the spacebar to advance the text and ‘q’ to quit.)

If you want to save all the information to a file so that you can send it to someone or post it online, you can type:

dmesg > whatever_you_want_to_call_the_file

If you’ve just opened a terminal, you’re probably in your home directory; that’s where the file will appear.

(Make sure you don’t use the name of an existing file. If you want to check what other files are in your current directory, type ls on the command line.)


Filed under: Command line,Logs
Tags:
May 12th, 2010 12:33:11

Ubuntu linux: where to find error logs, messages, bootup messages, etc. and how to read them

May 12th, 2010

Various logs can be found here:

/var/log

They can be read by opening a terminal (Applications -> Accessories -> Terminal in Ubuntu 10.04, etc.) and typing:

cd /var/log
less name_of_logfile

(Use the space bar to go to the next page; type ‘q’ to quit.)

Most of the files in /var/log can also be viewed using Ubuntu’s Log File Viewer. In 10.04, this is found by navigating to System -> Administration -> Log File Viewer from the taskbar. There is a menu listing the available logs on the left-hand side of the Log File Viewer; click on the name of a file to view it.


Filed under: Command line,Logs
Tags:
May 12th, 2010 12:21:16

Firefox 3.6.3: Disable third party cookies

May 11th, 2010

Woo! New version of Firefox came with Ubuntu 10.4!

I couldn’t immediately figure out how to opt out of receiving third-party cookies, but got there in the end. Here’s where the tickbox is hidden….

Navigate to Edit -> Preferences and select the Privacy tab.

Under the ‘History’ heading, there is a line that starts “Firefox will:” and a drop-down menu. Select “Use custom settings for history” from the drop-down menu.

This will cause some new options to appear, including “Accept third party cookies”. Untick this box and click “Close”.


Filed under: Customisation
May 11th, 2010 12:32:26

Ubuntu 10.04: installing java and the CGoban 3/KGS client

May 10th, 2010

Now to get KGS working on the 10.04 machine….

First, java is needed:

sudo apt-get install openjdk-6-jre

A quick check of java -version tells me I’ve just installed

java version “1.6.0_18”
OpenJDK Runtime Environment (IcedTea6 1.8) (6b18-1.8-0ubuntu1)
OpenJDK Client VM (build 14.0-b16, mixed mode, sharing)

Then, I downloaded cgoban.jnlp from the KGS CGoban Download page by clicking the link entitled “CGoban for Java Web Start”.

I put this file on my desktop.

Run cgoban.jnlp by typing

javaws cgoban.jnlp

from the command line or double-clicking or right-clicking the file and choosing “Open with OpenJDK Java 6 Web Start”.

This causes a file called CGoban_3.desktop to appear on the desktop and opens CGoban 3 (which provides an option for connecting to KGS). The first time this runs, a security warning about digital signatures pops up; I ticked the “Always trust content from this publisher” box and clicked “Run”.

After this, CGoban and KGS can be accessed by double-clicking CGoban_3.desktop (or by right-clicking and selecting ‘Open’).

Doing this gave me an warning message:

Untrusted application launcher

The application launcher “CGoban_3.desktop” has not been marked as trusted. If you do not know the source of this file, launching it may be unsafe.

The only option was to ‘Cancel’ the launch.

To allow this to run, right-click CGoban_3.desktop and choose “Properties”. In the “CGoban 3 Properties” pop-up, choose the “Permissions” tab and click the box near the bottom that says “Execute: Allow executing file as program”. (This caused the file to display on my desktop as “CGoban 3” with a KGS go stone logo.)

Double-clicking (or right-clicking and choosing “Open”) now opens CGoban and allows one to connect to KGS.

The cgoban.jnlp file can now be deleted or moved elsewhere.

Note: I get a significant delay between clicking the icon and the CGoban main menu appearing – long enough that I tend to think I haven’t clicked properly or that something is broken. It is a muuuuuch longer delay than the unnoticeable pause I get between clicking and menu coming up in Ubuntu 8.04 with Java 1.5.0_22.


Filed under: cgoban/KGS client,Installation,Ubuntu 10.04
May 10th, 2010 16:49:01

Ubuntu 10.04: turn off automatic screen lock/disable re-login after computer has been idle

May 10th, 2010

Navigate to:

System -> Preferences -> Screensaver

to open the Screensaver Preferences" dialog box.

Uncheck "Lock screen when screensaver is active" at the bottom of the dialog box.


Filed under: Customisation,Ubuntu 10.04
May 10th, 2010 16:19:30

How to tell which version of java is running in linux (Ubuntu)

May 10th, 2010

Command line

To find out which version of java is installed, type

java -version

in a terminal window. This will give something like this:

java version “1.5.0”
gij (GNU libgcj) version 4.2.4 (Ubuntu 4.2.4-1ubuntu3)

Browser

You can also visit www.java.com’s Verify Java Version page. On this page, there is a pleasingly big red button that you can click which will tell you what version of java is installed.

Pressing the pleasingly big red button will tell you something like this:

Your Java version is 1.5.0_22

Of course, if one isn’t running the latest and greatest version, this page tells you to install the most up-to-date version, but I usually prefer to wait until there is an official Ubuntu update.


Filed under: Command line,General,java
May 10th, 2010 12:12:07

Ubuntu 10.04 – getting xmms to work again

May 09th, 2010

Well, yet again xmms isn’t working. Oh, life is hard when one loves deprecated software!

Now, to make matters worse, some of xmms’ dependencies have been deprecated as well.

Out of sheer perversity, I decided to install all the old schtuff to see if I could get xmms to work.

(I don’t necessarily recommend doing this in general, mind you – I usually try to avoid installing random deprecated things which may have security holes, conflict with everything else installed or generally cause annoyances. However, it was late and I was in a mood. Since installation, Since installation, I’ve had a closer look and I don’t think that adding these deprecated packages should cause any problems for a clean installation of 10.04, but it is possible that they could cause conflicts with other packages one might choose to install. For me, it is definitely worth the risk!)

Here’s what I did to get xmms working:

Went to:

Downloaded and installed:

  • libglib1.2ldbl_1.2.10-19build1_i386.deb

Went to:

Downloaded and installed (in this order):

  • libgtk1.2-common_1.2.10-18.1build2_all.deb
  • libgtk1.2_1.2.10-18.1build2_i386.deb

Went to:

Downloaded and installed:

  • xmms_1.2.10+20070601-1build2_i386.deb

Amazingly, this seemed to work!

…Mostly. I’m now getting some terrible moments where the track repeats until I move the mouse. It sounds rather like a CD does when it gets caught on and plays the same hyper short bit of a track over and over again until someone with Fonz power hits it. There was certainly no such bad behaviour a couple days ago when I was happily xmms-ing away on Jaunty.

Just for kicks, I tried Audacity and, interestingly enough, it seems to be plagued with the same skippy repeaty problem.

I don’t think this skipping is a problem with xmms; I think it’s a problem with something else. If this happens, closing and re-opening xmms sometimes works. If other applications are running that involve audio, try closing them. On one occasion, I had to restart the computer, but after that xmms worked fine.

Not sure what’s going on. Audio is a black art. I’m going to bed.


Filed under: Fixes,Ubuntu 10.04,xmms
May 09th, 2010 03:11:02