CPAN on a fresh Linode

Tags:

On a nice fresh Linode with CentOS or Debian: There is no cpan... or an insufficient one.

*CentOS: *$ sudo yum install perl-CPAN

OK, now

$ cpan

works great but, without any of the development tools, 'make' isn't even found. Specifically you will see this error, drowning amongst a sea of others:

Can't exec "make": No such file or directory

We need:

*CentOS: *$ sudo yum groupinstall 'Development Tools' *Debian:* $ sudo apt-get install build-essential

And then:

$ sudo cpan cpan> install Test::More cpan> install Term::ReadLine cpan> install Term::ReadLine::Perl *# At least on Debian, just ReadLine is not enough* cpan> install Term::ReadKey

A primer on remote branches with Git

Tags:

Here we assume that

  1. You have set up a local working directory to edit the source code of Simutrans-Experimental, your favorite game; and

  2. Tou would like to compile one of the branches to test it.

First, setup git. Now we go get James's repository:

$ git clone https://github.com/jamespetts/simutrans-experimental

List remote branches only:

$ git branch -r

List all remote branches, and lots of other info:

$ git remote show origin

Create a local branch to track a remote branch:

$ git branch --track running-powers origin/running-powers

Have our local working copy, track the named branch:

$ git checkout running-powers

Go get it

$ git pull

Show local branches:

$ git branch
10.x
master
* running-powers

OK let's build that:

$ make -j3
[...]
===> LD build/default/simutrans-experimental

Cool! Now, copy that binary to our games-playing directory:

$ cp -a build/default/simutrans-experimental ~/simutrans/sim-exp/

If some git commands refuse to proceed because they’re worried about clobbering untracked files, and you’re certain that all untracked files and directories are expendable, then delete them mercilessly with:

$ git clean -f -d

Git: Untracked files problem

Tags:

I edited my working copy of a project in git and now I can't do a git pull to merge, because I added a few files. I don't have commit privileges on the remote project, so I emailed them to the maintainer, and now git won't merge them in. I get this error:

error: The following untracked working tree files would be overwritten by merge:

There are two ways to handle this:

What will happen if I 'git fetch' or 'git pull'?

Tags:

If you have used svn for years, git can seem a little strange.

Half the problem is the different mindset -- let's tackle one common problem: How do I know what will happen if I do a git fetch or a git pull? First let's do a status:

$ git status
# On branch master
# Your branch is behind 'origin/master' by 3 commits,
  and can be fast-forwarded.

That's a lot friendlier than svn's equivalent svn diff. And that status gives us the clue as to what we would like to compare: it's simply our copy (master) and the one it's "behind" (origin/master). So if we request:

$ git diff master origin/master

we will get a nice difference between our copy (shown in the diff with -) and the remote (shown with +).

See also, these comments on stackoverflow and the Git Cheat Sheet

Virtualmin Configuration and Tuning

Tags:

Upon first install Virtualmin, you will need to set a few configuration parameters:

We will be disabling root login to webmin / virtualmin. Start by creating an administration group:

The default should be to use Unix authentication for the Webmin users. That means, resetting your Unix password will update your Webmin login as well.

Logout of Webmin and then back in with your username. Go back to Webmin Users and click on the 'root' user in the list of users. Set the password to "No password accepted" and voilá, your Webmin is now a little more secure.

Disabling Unused Cronjobs

CentOS in particular puts unwanted tasks in the cron entries. They do not appear in the 'crontab' proper but in /etc/cron.daily and /etc/cron.hourly. Rename these files to be their hidden dotfile equivalents:

cron.daily/.00webalizer
cron.daily/.freshclam
cron.daily/.makewhatis.cron
cron.hourly/.awstats

Otherwise, awstats will run every hour for every domain, regardless of the settings you make in Virtualmin. Also I disabled 'makewhatis' 'webalizer' and 'freshclam' as I am not using them.