You are hereBlogs / My blog / hutcho's blog

hutcho's blog


How to start common Ubuntu GUI programs from the terminal

Alt-F2
Allows you to start a program (if you know the name of it)

A terminal session
gnome-terminal

Driver management
jockey-gtk

Graphics card config
nvidia-settings

The software update manager
update-manager

Startup programs
gnome-session-properties

Renew SSL certificate on Ubuntu and Apache2

I just had to renew my SSL certificate and wanted to make a couple of notes that someone might find handy. (Probably me next year)

* Find the CSR file. (Or you can/should generate a new one)
Open /etc/apache2/sites-available/www.yoursite.com and search for '.key' which gives you the directory where the CSR file should be.
Or run something like the following command: find / -name '*.csr'

* Open the CSR file in nano and copy the text into the renew certificate field from your hosting provider.

Output dynamic user specific XML content via Drupal node

My set up is Drupal 6 on LAMP (Linux/Apache/MySQL/PHP) and I needed to dynamically generate XML on a per user basis as a data transfer mechanism between MySQL and the web browser via PHP and Java (I.e. AJAX) for a mapping application.

The actual code is pretty simple really, but finding the right place to put all the bits was very frustrating. I couldn't find an article that really nailed it, so here is what I did.

There are a number of elements needed to achieve this.
* Linking to drupal user managment (getting access to global $user).

Comparing files in Nautilus with diff-ext

Install:
$ sudo apt-get install diff-ext
Restart Nautilus (Log out)

Usage:
Pick two files and right click -> compare.

References:
http://morgancollett.wordpress.com/2008/11/19/comparing-files-in-nautilu...

How to setup Eclipse with PHP plugin on Ubuntu 9.10

Install Eclipse from the package manager.

Then:
sudo add-apt-repository ppa:yogarine/eclipse/ubuntu && sudo apt-get update
sudo apt-get install eclipse-pdt

Sooooo much easier than I remember on 8.04 and 8.10.

Similarly to install RabbitVCS
sudo add-apt-repository ppa:rabbitvcs && sudo apt-get update
Search package manager for rabbitvcs, there are about 6 plugins.

References:
https://help.ubuntu.com/community/EclipsePDT
http://blog.yogarine.com/2009/10/eclipse-plugin-packages-for-ubuntu.html
http://wiki.rabbitvcs.org/wiki/download

How to disable amavis and clamav

Edit: /etc/postfix/main.cf

#content_filter = amavis:[127.0.0.1]:10024
#receive_override_options = no_address_mappings

Edit: /etc/postfix/master.cf

#amavis unix - - - - 2 smtp
# -o smtp_data_done_timeout=1200
# -o smtp_send_xforward_command=yes

#127.0.0.1:10025 inet n - - - - smtpd
# -o content_filter=
# -o local_recipient_maps=
# -o relay_recipient_maps=
# -o smtpd_restriction_classes=
# -o smtpd_client_restrictions=
# -o smtpd_helo_restrictions=
# -o smtpd_sender_restrictions=
# -o smtpd_recipient_restrictions=permit_mynetworks,rej ect
# -o mynetworks=127.0.0.0/8

Setup SNMPTT in Ubuntu 8.10 for traps to go to MySQL

Download from here:
http://sourceforge.net/projects/snmptt/files/

Basic installing from here (with exceptions below):
http://snmptt.sourceforge.net/docs/snmptt.shtml#Installation-Unix

Found some of the paths not right for Ubuntu such as:
cp snmptt.init.d to /etc/rc.d/init.d/snmptt
should be
cp snmptt.init.d to /etc/init.d/snmptt

9.4. I see following error: Can't locate Config/IniFiles.pm in @INC ...What should I do?

LAMP Memory Tuning

Running a VPS? Going over your oomguarpages limit?

Well this should help
http://onlamp.com/pub/a/onlamp/2004/02/05/lamp_tuning.html

In particular check out the section about MaxRequestsPerChild and you can use this command ps axu --sort:rss to see how much RAM you are using.

Where is PHP.ini installed in Ubuntu 8.10?

1) PHP Web server
To find this one create a file with <?php phpinfo(); ?> and run it on your web server.
/etc/php5/apache2/php.ini

2) PHP Client
To find this run this command.
$ php -r "phpinfo();" | grep php.ini
/etc/php5/cli/php.ini

How to get fopen to work with crontab

Basically you need to understand three things to understand how this works:

1) Which user is the php file running as?
- When you run "crontab -e" the user you are running it as will be the user the php file runs as.

2) What are the permissions on the log file?
- Check the permissions, owner and group using "ls -al"

3) What are the permissions on the php file?
If you run the php file with a directive #!/bin/php at the top of the file then you need to set executable permissions on the file. If you specify php /path/to/phpfile.php then you don't need to do this.