Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Updating a self-signed SSL certificate for Apache on Ubuntu 12.04


I had to update a self-signed SSL certificate for Apache today on an Ubuntu 12.04 server, as the old certificate had expired. I found a recipe for Debian which explained the process in a way that I was able to adapt to Ubuntu. Here is the complete process to renew your cert for another 365 days:


Change directories to the certificate location:

cd /etc/apache2/ssl

Generate a new key:
sudo openssl genrsa -out example.com.key 1024 

Generate a certificate signing request:

sudo openssl req -new -key example.com.key -out example.com.csr 
 
Generate a new certificate, by signing the CSR with the key:

sudo openssl x509 -req -days 365 -in example.com.csr \
  -signkey example.com.key -out example.com.crt 

 
Move the old key and certificate away, and copy the new key and certificate in: 

sudo mv apache.key apache.key.old
sudo cp example.com.key apache.key
sudo mv apache.crt apache.crt.old
sudo cp example.com.crt apache.crt 
 

Restart the webserver:

sudo service apache2 restart

Now, load your website via SSL.  You should be prompted to accept the untrusted certificate (not expired). Add the permanent exception, and you're good to go for another 365 days.

Cloning Scrapy scrapers easily with django-dynamic-scraper

Scraping requires some flexible tools.

The backstory


I have a Django project which uses django-dynamic-scraper, a scrapy wrapper, to gather data from various websites. I found myself creating a series of nearly identical scrapers to get data from different parts of these sites. This was rather inefficient since each scraper had a dozen fields or so, and there is no built in solution for copying a scraper.

I explored form autofill solutions before realizing I was overthinking the problem. All I needed to do was create a small script taking advantage of Django model access. This could probably be worked into manage.py, but I just wanted something to run in a hurry.

The script


clone-scraper.py:

import sys
from dynamic_scraper.models import Scraper, ScraperElem

s = Scraper.objects.get(name='My Template')
s.name=sys.argv[1]
s.id = None
s.pk = None
s.save()

se = ScraperElem.objects.filter(scraper__name='My Template')

for item in se:
    item.scraper = s
    item.id = None
    item.pk = None
    item.save()

Usage


python clone-scraper.py "New Scraper Name"

I run this script from within my virtualenv where Django lives. That gives it access to the models in my apps. If you're not sure which python executable you're using, run "which python" to find out. You want the one from the virtualenv.


How it works


The script first accesses the django-dynamic-scraper models to work with. Then it gets the "template" Scraper to be copied from, which has already been created. This working copy of a Scraper has its name set to the first command line argument. It also has its keys reset so that a new Scraper can be saved and given a new ID.

Then, the different ScraperElem fields from the new scraper are called and given the values of the fields from the template. Finally, those ScraperElem objects are saved.

This is tested on Django 1.5 and 1.5.2, but the technique should work with older versions.

Homework


Add a second argument for template name.

Upgrading Kubuntu 12.04 to 12.10 Beta 1 "Quantal Quetzal"

Softpedia screenshot of the Kubuntu 12.10 Beta 1 default desktop
As noted on the official Kubuntu site http://www.kubuntu.org/news/12.10-beta-1) site, Kubuntu 12.10 beta 1 has been released. Here's how I upgraded my Ubuntu 12.04 system with KDE desktop to 12.10:

Bitcoin Mining on Ubuntu 11.04 "Natty" with poclbm and ATI


Updated 6/19/2011 - updated bitcoin app version to 0.3.23, simplified bitcoin setup directions

Updated 6/8/2011 - updated example app versions, clarified use of pools, clarified use of bitcoin standalone app, path cleanup, added link to headless mining guide

1. Introduction


Recently, I got interested in the new peer-to-peer digital currency, Bitcoin (read about it all about it at bitcoin.org if you're not familiar with it yet). Having decided to make use of my idling ATI graphics card for some bitcoin mining, I was able to cobble together a mining setup on Ubuntu 11.04 "Natty Narwhal" without too much trouble. It uses a standard miner app "poclbm", the Python OpenCL Bitminer.

Ubuntu 11.04 "Natty" release


The new Ubuntu 11.04, codenamed "Natty" has been released today! You can get it via Update Manager if you're already running Ubuntu 10.10. If you're new to Ubuntu, you'll want to visit the download page and get your Ubuntu installer CD image. You can also visit the main Ubuntu site to learn more about this release.

Upgrading Ubuntu from 10.04 to 10.10 with a local mirror

I upgraded from Ubuntu 10.04 to Ubuntu 10.10 on my desktop today, using Update Manager. Since 10.04 is a Long Term Support release which features a long period of stability (bug fixes and security fixes only), 10.10 is not automatically offered. I had to hit the Settings button in Update Manager to bring up the Software Sources dialog, then the Updates tab and select "Normal releases" from the Show new distribution releases: drop-down menu in order to get the 10.10 upgrade to show up.

How to get help with Ubuntu on IRC chat

If you're new to Ubuntu or Linux, and you've ever run into a problem or question that you just can't seem to solve with Google searches, you will be happy to know that there is another resource available to you. Even if you're experienced, there's always going to be something new and obscure that trips you up once in a while. That's where IRC comes in.

IRC (Internet Relay Chat) is an ancient protocol for chatting on the Internet which is alive and flourishing. It is the predecessor to IM software, Web chatrooms and online gaming chat systems. IRC is commonly used for informal support and chat related to application software, operating systems, games, and a whole host of general interest topics like sports, politics and religion.

Building TrinityCore 9847 with TrinityDB r34 on Ubuntu 10.04

Well, another TrinityCore/TDB release has arrived (http://forum.trinitycore.org/topic/28139-tdb-3351134-love-hate-and-passion-has-been-released/), so I'm rebuilding my Trinity server from scratch and sharing the process again. Happily, I saw much fewer errors than when I built r33. No errors, in fact!

Accordingly, this guide describes the process of setting up TrinityCore revision 9847 with TrinityDB 335.11.34 (TDB r34) on an Ubuntu 10.04 system. The directions should work on Ubuntu 9.10 but have not been tested there. I got most of my clues from http://www.trinitycore.info/index.php?title=Installing_TrinityCore_on_recent_Linux-based_systems. I highly suggest you keep that document handy while following this guide, as it goes into detail on many explanations which I will be glossing over.

Installing TrinityCore dependencies on Ubuntu 10.04

This guide is meant to accompany my release-specific build guides for TrinityCore/TDB releases on Ubuntu, in order to cut down on duplicate content in those posts since these procedures for brand new installations don't change.

TrinityCore dependency packages in Ubuntu

First, install the Ubuntu packages required for building TrinityCore.

Building Xnee 3.06 on Ubuntu Lucid 10.04

Recently, I wanted to use Xnee (http://www.sandklef.com/xnee/) to automate some GUI application actions on an Ubuntu Lucid 10.04 installation, but I found that the version of Xnee available from the Lucid repositories still has some problems. Specifically, this older Xnee version, 3.02-2ubuntu2, still contains workarounds for some previously existing Xorg RECORD extension problems which have themselves now been fixed in Lucid. The outcome of this mismatch is that recording fails with any of cnee, gnee or pnee. This is resolved in the next release of Ubuntu, 10.10 "Maverick", which includes Xnee 3.06, but I preferred not to upgrade the entire system to a pre-release state just to get this one application working.

Installing Heroes of Newerth Beta on Ubuntu Linux 9.04 Jaunty


Well, I got my beta key for Heroes of Newerth through the recent Slashdot giveaways. I'm excited as I used to play Starcraft back in the day, but never got into DotA. Here is my experience installing this *early closed beta* version of the game and first playing it.

Berkeley Logo and the Turtle on Ubuntu Linux

Berkeley Logo drawing with the Turtle on Ubuntu

As a kid, the first programming language I ever saw was a variant of Logo on an Amstrad PC/M system. I discovered its graphic system, the "Turtle" and how it could be used to create Spirograph-like images in a totally different environment from the word processing application or the file manager (which resembled Midnight Commander!)

So naturally I have to see what it looks like now:

sudo aptitude install ucblogo

According to the user manual (http://www.cs.berkeley.edu/~bh/usermanual) "Berkeley Logo provides traditional Logo turtle graphics with one turtle. Multiple turtles, dynamic turtles, and collision detection are not supported."

I start the interpreter with 'logo' in a Terminal.

I put my pen down:

pd

Hide the turtle:

ht

And draw a fancy shape!

repeat 65 [fd 300 rt 165]

I was very pleased to get back up and running with Logo. However, I doubt I'll truly be satisfied until I can run an emulated version of the entire Amstrad PC/M system!

Edit: This post was originally published for Ubuntu 8.10. Tested working OK with identical commands in Ubuntu 12.10. Happy turtling!

A 3d File System Viewer: Building FSV on Ubuntu 8.10 "Intrepid"


FSV is a 3d file system viewer which reimplements FSN, memorable for its appearance in Jurassic Park. You can read about FSN here:

http://www.siliconbunny.com/fsn-the-irix-3d-file-system-tool-from-jurassic-park/

The FSV website at http://fsv.sourceforge.net/ provides the downloadable source code for FSV, and here is how to build it:

Building Hydrogen drum machine from SVN on Ubuntu 8.10 "Intrepid"

The SVN repository for the Linux drum machine software, Hydrogen has recently moved. You can read today's hydrogen-devel post about it here:
http://sourceforge.net/mailarchive/forum.php?thread_name=4941A8C4.7070206%40smoors.de&forum_name=hydrogen-devel

Here is how I installed Hydrogen from the new repository today on my 8.10 Intrepid system (you'll need the QT libraries, libqt4-dev if you don't already have them, as well as build-essential and probably a few others I'm forgetting):