- Published:
- February 6, 2009 – 10:39 am
- Author:
- By Dave
Windows files and Unix files (Redhat, Ubuntu, etc) are encoded in different ways. Namely, the end of line that is a part of most files created in Windows is not compatible with Unix. You can usually see this because there is a ‘weird character’ at the end of each line. ‘cat’ does not show it, but ‘cat -e’ will show these characters: xx.xx.125.240 spc240.xx.xx^M$ xx.xx.125.241 spc241.xx.xx^M$ The ^M is a Windows ‘End of Line’ character. Fortunately there is an easy way to fix these for using them in a unix based system. Install ‘dos2unix’, and then run the file through them: dos2unix filename You can even run these on a bunch of files: [root@ns1 ~]# dos2unix RDNS-* dos2unix: converting file RDNS-xx.xx.81 to UNIX format … dos2unix: converting file RDNS-xx.xx.82 to UNIX format … dos2unix: converting file RDNS-xx.xx.85 to UNIX format … dos2unix: converting file RDNS-xx.xx.95 to UNIX format … dos2unix:….
Categories: Linux,Shell,System Administration,Windows
Tagged: character encoding, dos2unix, end of line, recode
- Published:
- December 29, 2008 – 3:58 pm
- Author:
- By Dave
I recently got stuck while trying to install Headless Virtualbox on a Centos 5.2 server per the directions at Howtoforge here. The RPM failed with the error that it couldn’t find the kernel source. I thought I had already installed kernel-devel, and confirmed that I did. The instructions were to define the KERN_DIR variable like so: $ export KERN_DIR=/usr/src/kernels/2.6.18-92.1.22.el5-i686/ $ /etc/init.d/vboxdrv setup Stopping VirtualBox kernel module [ OK ] Removing old VirtualBox netflt kernel module [ OK ] Removing old VirtualBox kernel module [ OK ] Recompiling VirtualBox kernel module [ OK ] Starting VirtualBox kernel module [FAILED] (modprobe vboxdrv failed. Please use ‘dmesg’ to find out why) dmesg shows this: vboxdrv: disagrees about version of symbol struct_module Interesting! After several missteps, it turns out there is a separate development rpm for the PAE kernel: $ yum install kernel-PAE-devel After that installs, we are good: $ export KERN_DIR=/usr/src/kernels/2.6.18-92.1.22.el5-PAE-i686/ $ /etc/init.d/vboxdrv….
Categories: Configurations,Linux,Programs,Shell,Software,System Administration
Tagged: error, kernel, virtualbox
- Published:
- December 7, 2008 – 2:10 am
- Author:
- By Dave
Readers should note that this applies to Ubuntu 8.10 Intrepid Ibex only! ZFS is a relatively new filesystem created by Sun. It is released under the CDDL License which is incompatible with Linux’s GPL License, meaning that it can not be installed natively in the kernel. Therefore, for not it is relegated to addon packages and is brought to Ubuntu via the Fuse framework. For more information on this see the Ubuntu Wiki article on ZFS. The wiki article also explains this, but getting ZFS installed on Ubuntu is actually pretty straightforward by issuing these commands: $ sudo echo “deb http://ppa.launchpad.net/brcha/ubuntu intrepid main” >> /etc/apt/sources.list.d/zfs-fuse.list $ sudo echo “deb-src http://ppa.launchpad.net/brcha/ubuntu intrepid main” >> /etc/apt/sources.list.d/zfs-fuse.list $ sudo apt-get update $ sudo apt-get install zfs-fuse This installs zfs onto your system. Now to create your raid-z array! Its dead simple. $ sudo zpool create media -m /storage raidz /dev/sda /dev/sdb /dev/sdc In….
Categories: Configurations,Linux,Shell,System Administration,Ubuntu
Tagged: filesystem, RAID, sysadmin, zfs
- Published:
- November 21, 2008 – 3:17 pm
- Author:
- By Dave
I recently tried to install a PHP PECL extension on a server I manage, when I received this error: [root@xxxx PDO-1.0.3]# pecl install pdo downloading PDO-1.0.3.tgz … Starting to download PDO-1.0.3.tgz (52,613 bytes) ………….done: 52,613 bytes 12 source files, building running: phpize Configuring for: PHP Api Version: 20041225 Zend Module Api No: 20060613 Zend Extension Api No: 220060519 /usr/local/bin/phpize: /tmp/pear/temp/PDO/build/shtool: /bin/sh: bad interpreter: Permission denied Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable is set correctly and then rerun this script. ERROR: `phpize’ failed [root@xxxx PDO-1.0.3]# After some searching, I figured out this is because I had set /tmp to noexec to keep any intruders from executing files from this directory. I suspect the same error will occur with any PECL extension installation. I temporarily turned it off with the command: mount -oremount,exec /tmp Now PECL installs extensions fine. Don’t forget to reenable noexec when….
Categories: Configurations,Linux,Shell
Tagged: pecl, PHP, sysadmin
- Published:
- November 1, 2008 – 9:56 pm
- Author:
- By Dave
If you are running Apache for your web server, and mod_rewrite is installed (this is a pretty typicaly module on all installations) this is actually pretty easy. RewriteEngine on RewriteCond %{HTTP_HOST} ^subdomain\.yourdomain\.com RewriteRule ^(.*)$ http://www\.yourdomain\.com/subdomain/$1 [L] Add this code to your apache configuration file – the easiest location is in the .htaccess file in your root web directory. This should redirect the browser with a 302 Found message. You can do some pretty fancy things with mod_rewrite, but this is simple and gets the job done!
Categories: Code Samples,Linux,Other Code,Software
Tagged: apache, mod_rewrite, web server
- Published:
- October 14, 2008 – 3:16 pm
- Author:
- By Dave
Found a great post over at good coders code, great reuse. This one deals with performing operations on sets using only unix (bash) command line operations on files of text. * Set Membership. Test if an element belongs to a set. * Set Equality. Test if two sets contain the same elements. * Set Cardinality. Return the number of elements in the set. * Subset Test. Test if a given set is a subset of another set. * Set Union. Find union of two sets. * Set Intersection. Find intersection of two sets. * Set Complement. Given two sets A and B, find all elements in A that are not in B. * Set Symmetric Difference. Find symmetric difference of two sets. * Power Set. Generate all subsets of a set. * Set Cartesian Product. Find A x B. * Disjoint Set Test. Test if two sets are disjoint. *….
Categories: Code Samples,Linux,Shell
Tagged: awk, bash, grep, join, sed, set operations, union
- Published:
- October 6, 2008 – 11:45 am
- Author:
- By Dave
It is possible to install Active Directory authentication in Ubuntu 8.04 and later. The Likewise Open packages accomplish this task, and it is actually pretty easy. Just a note – when installing Ubuntu, do not add a user named “administrator” as I did. This makes it impossible to join the Ubuntu workstation to the domain using the “administrator” active directory user – but you can use a different Domain Administrator username and password. The steps to follow: sudo apt-get install likewise-open sudo domainjoin-cli join fdqn.yourdomainserver Administrator sudo update-rc.d likewise-open defaults sudo /etc/init.d/likewise-open start As a side note – you should also consider adding the following code to make it so that users do not have to login with DOMAIN\username on the ubuntu login screen. You can do this by changing /etc/samba/lwiauthd.conf and adding this line: 1winbind use default domain = yes Also, another helpful tidbit of information is getting your….
Categories: Linux,Security,System Administration,Ubuntu,Windows
Tagged: active directory, likewise, login, lwidentity, Ubuntu