uShare autostart – Ubuntu 11.04

Previously, I installed ushare easily on Ubuntu following a process similar to this: https://help.ubuntu.com/community/Xbox360Media

I’ve recently become annoyed that ushare hasn’t been autostarting in Ubuntu 11.04. I suspect it may have something to do with the fact that I am using the same machine to host vpn so I have a bridged connection br0 as my main connection. The default script in /etc/init.d/ushare should be able to autostart, and I have tried adding it to rc.d using variation of this command “sudo update-rc.d ushare defaults 80”, however it fails to start. I have no trouble running it manually with the “/etc/init.d/ushare start” command however. So I’m guessing it is just trying to start before the network interfaces come up and failing. The workaround I found tries to solve this by explicitly running after the interface is up. The way to do it, is to add it to the “/etc/network/interfaces” file using something called “post-up”. Since I wanted to have ushare run after my br0 interface is brought up, I added it like at the bottom of the br0 section, see below:

iface br0 inet static
address 192.168.0.198
netmask 255.255.255.0
gateway 192.168.0.1
bridge_ports eth1
post-up /etc/init.d/ushare start

And, now on restart “ps ax | grep ushare” shows the process running. I am also able to connect on my xbox just as before 🙂

Sources: http://www.cyberciti.biz/tips/how-do-i-run-firewall-script-as-soon-as-eth0-interface-brings-up.html

MediaWiki + Ubuntu 11.04 & Customizations

Recently, I setup a personal wiki for myself since I’m always encountering more information than I have time to read, but always want to go back later. Its also a way for me to organize topics I don’t know as much about as I’d like so that I can remember to come back to those areas later on. (Inspired by fellow UoG Student Eddia Ma: http://eddiema.ca/wiki/) The default install from Ubuntu is pretty simple. I just installed it with the expected:

sudo apt-get install mediawiki

There are some simple steps to follow as you install with the package manager such as setting up the database and first configuration which should be easy enough to get through. However, the wiki required much customization before it would be good for what I was planning on using it for.

Citation Support

First of all, it had to support citations so that I could source the original papers, websites and others. This required the Cite Extension which can be downloaded here: http://www.mediawiki.org/wiki/Special:ExtensionDistributor/Cite (make sure you select the version that corresponds to the mediawiki version you have installed. Next extract to your extensions folder (likely /var/lib/mediawiki/extensions/ on Ubuntu 11.04). Finally add the following line to your mediawiki configuration file LocalSettings.php (likely in /etc/mediawiki).

require_once("$IP/extensions/Cite/Cite.php");

Attachments

I wanted to be able to attach papers directly into my wiki (pdfs and other documents from academic papers). For this I had to add the following line to my LocalSettings.php file (likely in /etc/mediawiki):

$wgFileExtensions = array('png','gif','jpg','jpeg','doc','xls','mpp','pdf','ppt','tiff','bmp','docx', 'xlsx', 'pptx','ps','odt','ods','odp','odg');

Additionally, I encountered problems uploading many larger pdfs since they are larger than the default php upload size. In ubuntu, this can be changed by modifying the php.ini file (likely located in /etc/php5/apache). Look for ‘upload_max_filesize’ and ‘post_max_size’ in order to change this to whatever size you like.

Math!

Of course being a CS student, I need to be able to add math equations into my wiki. The math formulas are entered using Latex which most CS grad students (and many undergrads) should know how to use. This one is in the Ubuntu repositories so it is easy to do:

sudo apt-get install mediawiki-math

Then you have to edit the LocalSettings.php file again (/etc/mediawiki) so that the wgUseTex flag is true:

$wgUseTeX = true;

Source Code – Syntax Highlighting

Again since I am a CS student, my wiki needs to be able to display source code easily in a readable way. For this I use the Ubuntu package manager again:

sudo apt-get install mediawiki-extensions-geshi

And edit the LocalSettings.php file (/etc/mediawiki) – For some reason, other instructions I have online have different paths and names for the plugin, so this will only work using the plugin from the repository. If you download it yourself directly, the name and location may be different:

require_once("$IP/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php");

Wiki Privacy

Lastly, as I previously mentioned the wiki is private (at least for now). To do this it is quite simple. Just paste this into the bottom of your LocalSettings.php file. (There are other variations on how private you can make the wiki, but if you want to do that, check out the official mediawiki page)

# Disable reading by anonymous users
# See: http://www.mediawiki.org/wiki/Manual:Preventing_access#Restrict_viewing_of_all_pages
$wgGroupPermissions['*']['read'] = false;

# But allow them to access the login page or else there will be no way to log in!
# NOTE: You also need to provide access here to the .css and .js files that the
# allowed pages attempt to load; otherwise, users will get errors on the page
# when they attempt to load it (IE will complain about the errors;
# FF will show them in its error console)
# [You also might want to add access to "Main Page", "Wikipedia:Help", etc.)
$wgWhitelistRead = array ("Special:Userlogin", "MediaWiki:Common.css",
"MediaWiki:Common.js", "MediaWiki:Monobook.css", "MediaWiki:Monobook.js", "-");

# Disable anonymous editing
$wgGroupPermissions['*']['edit'] = false;

# Prevent new user registrations except by sysops
$wgGroupPermissions['*']['createaccount'] = false;

Ubuntu 13.04 – Latex

Update: This also continues to work on Ubuntu 13.04

Just a quick note to myself really about how to get Latex working the way I want on Ubuntu 11.04 (Texmaker GUI, and some fixes for some errors I was getting). The error that was most troublesome was ‘kpathsea: Running mktexmf ptmr7t! I can’t find file `ptmr7t’.’ This was fixed with the recommended fonts package. I also got an error about an equation style that it didn’t know. This was fixed with the texlive-science package.

If you also get an error about `uct12.clo` you need to add the “texlive-publishers” package. See below for all the usual packages you need for ubuntu.

sudo apt-get install texlive-latex-base texmaker texlive-fonts-recommended texlive-science texlive-publishers texlive-fonts-extra texlive-math-extra

Update: I’ve discovered a tex plugin for gedit, which is kind of cool, if you are interested check out this blog post: http://blogs.ethz.ch/ubuntu/2007/06/09/gedit-goes-latex-1-gedit-latexplugin/

References:

Tutorial: Ubuntu 12.04 / 11.04 / 10.10 / 10.04 – Grub 2 with Themes

In this post, I will show you how to install grub 2 with themes so that you can replace the standard text-based grub menu with something that looks a bit nicer. This tutorial will use code which is under development, so it may be best not to use on an important machine. We will actually replace grub with something called burg, which is a developmental branch of grub.

(more…)