Archive for the ‘Reference’ Category
Here’s how to install and configure an ftp server (proftpd) on a Ubuntu machine.
sudo aptitude install openbsd-inetd proftpd-basic (tell it to start from inetd, not standalone)
sudo vi /etc/proftpd/proftpd.conf (change ServerName)
System users (i.e. the ones that have an entry in /etc/passwd) can login to proftpd by default, with their system password; they will land in their home directory. To add “virtual users” (i.e. ftp-only users), do:
ftpasswd --passwd --shell=/bin/false --uid=502 --name=username --home=homedir --file=/etc/proftpd/ftpd.passwd (choose username, homedir)
Then add the following line to /etc/proftpd/proftpd.conf:
To allow your user(s) to upload files, just modify the homedir’s permissions.
CUPS (Common Unix Printing System) was released by Apple in 1999 and is used by practically all Linux distros. In addition to using system-config-printer you can administer your print system from its web interface, accessible on port 631. Just type http://localhost:631/ in your browser. You can view the status of your print server without authenticating yourself.
If instead you want to administer the print server (add/remove printers, cancel print jobs, etc), you need to login. Normally you’d use the root account and the corresponding password. However, the root account is locked in Ubuntu.
In theory, it’s enough to add your user account to the lpadmin group. If that’s not enough, add yourself also to the shadow group (
sudo usermod -aG shadow username), and then
sudo lppasswd -a username. Finally, modify /etc/cups/cupsd.conf, changing the DefaultAuthType to BasicDigest.
If you want to allow also other machines in your subnet to be able to control the cups server, modify /etc/cups/cupsd.conf and replace
Listen localhost:631 with
Port 631 and add
under <Location />
If you want the transmission bittorrent client to run as a daemon, so you don’t have to stay logged in, here’s how:
sudo aptitude install transmission-daemon
sudo service transmission-daemon stop
sudo vi /var/lib/transmission-daemon/info/settings.jsonand modify “download-dir”, “rpc-username”, “rpc-password”
sudo service transmission-daemon start
- go to http://localhost:9091/ and login
The .torrent files you had in transmission-gtk are stored under ~/.config/transmission/torrents/, just import them again.
Remember also to allow the user debian-transmission (transmission-daemon runs as this user) write access to the download directory.
You may also want to change “message-level” from 2 to 1 (from “info” to “error”), otherwise it kind of spams your syslog!
Configuration options reference: https://trac.transmissionbt.com/wiki/EditConfigFiles
Comment: I must say that the daemon is much less configurable than the gtk client: you can’t have different download directories for different torrents (for security reasons, I guess), no blocklists, no per-torrent options
This is a step-by-step guide for installing apache, php, redmine and other webserver stuff on Ubuntu 10.04 Lucid Lynx.
Apache 2.2.15 + PHP 5.3.2
Install the required packages:
sudo aptitude install apache2 libapache2-mod-php5. By default your site is under /var/www.
- To avoid the “Could not reliably determine the server’s fully qualified domain name” error each time you restart apache2, edit /etc/apache2/apache2.conf (Ubuntu’s version of httpd.conf) and add a line with ServerName and then the FQDN of your webserver
- To disable directory browsing in apache, edit /etc/apache2/sites-available/default and remove “Indexes” from “Options”.
- Each time you make modifications to apache’s configuration, restart it with
sudo service apache2 restart.
Redmine 0.9.4 + MySQL 5.1.48 + Subversion 1.6.12
Note: By default, redmine will use the sqlite3 database backend, which requires virtually no configuration. However if you want to use also svn with redmine, use mysql instead!
The way to get this to work (contrary to what the reference below says) is to install mysql-server before redmine!
sudo aptitude install mysql-server
sudo aptitude install redmine redmine-mysql libapache2-mod-passenger
sudo ln -s /usr/share/redmine/public /var/www/redmine
- add a line saying
PassengerDefaultUser www-datain the file /etc/apache2/mods-available/passenger.conf
- add the following lines to /etc/apache2/sites-available/default
<Directory /var/www/redmine> RailsBaseURI /redmine </Directory>
The default admin account in Redmine is user:admin, password:admin. Log in and change that password IMMEDIATELY!
You can do the rest of the configuration from the web-based interface.
Here’s a list of bootable Linux LiveCDs that will scan a Windows partition for viruses:
- OpenDiagnostics LiveCD (ClamAV on Ubuntu, previously ClamAV LiveCD)
- Kaspersky Rescue Disk (Kaspersky on ???)
- F-Secure RescueCD (F-Secure on Knoppix)
- Dr.Web LiveCD (Dr.Web on OpenBox-based Linux)
- S-T-D (hundreds of tools -including ClamAV- on Knoppix, used to be Knoppix-STD)
- Avira Antivir Rescue System (Avira on ???)
- SystemRescueCD (ClamAV on ???)
- Slax (ClamAV on ???)
And here are a few older, discontinued ones:
I have 5-6 machines in my LAN, all running Linux (except for my iPhone). All have DHCP reservations on my router, so they always get the same IP.
I have edited the /etc/hosts file in all Linux machines to include the dictionary of all machines on the LAN (matching IPs to hostnames). However, if anything changes, I’d have to go an edit /etc/hosts on each single machine. So I thought there must be a better way to do this, and starting studying. Here’s what I’ve come up with:
- in /etc/hosts you can add any IP-hostname pair you like (the Windows equivalent is LMHOSTS)
- in /etc/resolv.conf there’s the nameserver (set by NetworkManager), which is the router. The router is not an actual nameserver, it just relays DNS requests to the ISP’s DNS server
- in /etc/nsswitch.conf, under the entry “hosts:”, there’s the order according to which name resolution requests are resolved. By default it’s
files mdns4_minimal [NOTFOUND=return] dns mdns4
- Windows used to use WINS (a client-server architecture) for this sort of thing (NetBIOS name service, or NBNS). Names are not defined by the server, but instead clients register themselves and declare their names.
- Samba can act (among other things) as an NBNS server
I’d say the 4 main virtualization technologies for Linux are the following:
- KVM (RedHat)
- VMWare (EMC)
- VirtualBox (Oracle)
- Xen (Citrix)
The thing is, VMWare is proprietary, VirtualBox is proprietary if you want USB or RDP, and Xen requires a special kernel (rather than a kernel module, like KVM). So to me, the choice is easy…
- First, check if your CPU supports virtualization, and if it’s enabled in the BIOS (run
egrep '(vmx|svm)' /proc/cpuinfo --colour, vmx means Intel VT-x, svm means AMD-V).
- Then, install some packages:
sudo aptitude install qemu-kvm libvirt-bin virt-manager
- Regarding disk storage, you have storage pools and storage volumes. I use a directory-based pool and qcow2 volumes.
- The xml configuration files for each VM will either be under ~/.libvirt/qemu or under /etc/libvirt/qemu
- You really want to use virtio for better disk and network I/O performance
- To get a screen resolution > 800×600, change the video device from “cirrus” to “vga”
- To avoid filling up your main partition, create a virtual link for the directory countaining the virtual machine images:
sudo ln -s -d path_to_folder /var/lib/libvirt/images
Virtio in Windows XP
- download the driver while in the VM
- shut down the VM
- add a (dummy) virtio storage volume to the VM
- run the VM
- it will ask you to install the driver; provide the driver downloaded in step 1
- shut down the VM
- remove the dummy volume, remove the actual IDE volume of the VM
- add a virtio volume pointing to the same file
- run the VM
Editing an image
To mount the guest image volume (.img) from the host (as long as the guest is NOT running), do the following:
- sudo losetup /dev/loop0 path_to_img_file
- sudo kpartx -av /dev/loop0
- sudo mount /dev/mapper/loop0p1 mount_point
- do whatever you want to do
- sudo umount mount_point
- sudo kpartx -dv /dev/loop0
- sudo losetup -d /dev/loop0
Resizing an image
Resizing (growing) an existing qemu machine image is trivial:
- Convert from qcow2 to raw format:
qemu-img convert -f qcow qcow2_image -O raw raw_image
- Create an empty qemu image of the size that is the amount you want to grow your image:
qemu-img create -f raw temp_image 10G
- Concatenate the two images to a new one:
cat raw_image temp_image > new_image
- Convert the new image from raw back to qcow2
qemu-img convert -f raw new_image -O qcow final_image
- Boot your virtual machine with the new image. Use (format) the empty disk space at will.
- If you’re using raw images instead of qcow2, you can obviously skip steps 1 and 4.
- I saw some people suggesting using the dd command to replace steps 2 and 3, but others are saying it’s slower. Haven’t tried it myself.
- If you want to grow the root partition’s filesystem rather than create a new partition in the image, you can add the image to an existing Linux virtual machine and use gparted. Some are suggesting downloading the gparted livecd and booting a VM with that as a CD and your image as an HDD, then doing the resizing, shutting down and booting back into your normal VM.
Renaming a VM
- Edit the corresponding .xml file under /etc/libvirt/qemu
sudo service libvirt-bin restart