Archive for the ‘linux’ Category
Thursday, February 11th, 2010
Use visudo to edit /etc/sudoers
user host = NOPASSWD: /bin/kill, /bin/ls, /usr/bin/lprm
user, host and or the list of commands to be run can be swapped with the keyword ALL.
However that is probably not a good idea in most cases.
more info on this is in the manpages sudoers(5)
Tags: sudo, visudo
Posted in debian, linux, ubuntu | 1 Comment »
Wednesday, February 10th, 2010
Most of the time this error occurs that is a bad disk or a bad drive (or a bad cable).
Ubuntu 8.10 seams (from own experience and google) to be commonly affected by this.
You can try the following (I try them in this order)
- If you only get buffer errors and no CRC errors, just try and wait (a few minutes) It might still be possible to install
- Try another installation CD [from the same installation image] – if this works, then the other disk is bad
- Try to swap out the cable to the drive (if you have a ribbon cable use one with 80 connectors, not one with 40)
- Try to swap out the drive
- Try another installation CD [from another installation image, old version, other dist, windows] – if this works then there is an issue with the installation image – there might be an issue worth reporting
If all this fails or you wish to install the version you have, then using a usb stick to install the image might be a good idea.
Tags: I/O error, install, installing
Posted in ubuntu | 2 Comments »
Tuesday, February 9th, 2010
If you have a file that is saves as ISO-8859-1 (or ISO-LATIN-1 if you like to call it that) and wish to convert it to UTF-8 you can use:
iconv --from-code=ISO-8859-1 --to-code=UTF-8 ./oldfile.htm > ./newfile.html
This will create a new file with the converted encoding.
iconv can of of course convert to and from several other charsets. To see a list of all the encodings that iconv can work with use:
If you wish to massconvert files find can be used with exec
find . -name "*.txt" -exec iconv -f ISO-8859-1 -t UTF-8 {} -o {}.utf8 \;
Tags: charset, encoding, iconv, utf-8
Posted in Development, linux | No Comments »
Tuesday, February 9th, 2010
apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages have been kept back:
bind9-host dnsutils libbind9-50 libdns50 libisc50 libisccc50 libisccfg50 liblwres50 linux-generic linux-generic-pae linux-image-generic
linux-image-generic-pae
0 upgraded, 0 newly installed, 0 to remove and 12 not upgraded.
The message has been kept back most often means that the upgrade was kept back due to dependencies that are not met.
Some possible solutions
- A simple way is to invoke dselect to help out with the update. dselect performs the actions necessary to realize that state (for instance, the removal of old and the installation of new packages).
- While apt-get and aptitude are basically the same, aptitude is sometimes better at handling dependencies than apt-get
- Another solution is to install the package using apt-get install to install the upgraded package and let apt-get install the missing dependencies
Tags: apt-get, aptitude, debian, ubuntu
Posted in debian, ubuntu | No Comments »
Friday, February 5th, 2010
To re-configure exim4 on a Debian system just run
“$ dpkg-reconfigure exim4-config”
This will start the configuration process and you will be guided trough the configuration process.
Tags: debian, exim4, mail, mailserver
Posted in debian, exim4, ubuntu | No Comments »
Friday, February 5th, 2010
By definition shorewall is not a firewall, it is a way to (more) easily configure iptables to work as a firewall.
- First install shorewall “$ apt-get intall shorewall”
- Enter /etc/shorewall
- Copy the example files from /usr/share/doc/shorewall-common/default-config/ (might also be located in /usr/share/doc/shorewall/default-config/) “$ cp /usr/share/doc/shorewall-common/default-config/* .”
- Edit the files and enter the data that your system has
- First create zones “$ nano zones”
#ZONE TYPE OPTIONS IN OPTIONS OUT OPTIONS
fw firewall
net ipv4
vpn ipv4
- Connect zones with interfaces”$ nano interfaces”
#ZONE INTERFACE BROADCAST OPTIONS
net eth0 detect tcpflags,blacklist,dhcp
vpn tun0 -
- Create policies “$ nano policy”
#SOURCE DEST POLICY LOG LEVEL LIMIT:BURST
fw net ACCEPT
vpn net ACCEPT
vpn fw ACCEPT
fw vpn ACCEPT
net all DROP info
all all DROP info
- Create rules “$ nano rules”
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/
# PORT(S) PORT(S) DEST LIMIT GROUP
ACCEPT net fw tcp 22 # ssh
ACCEPT net fw tcp 80 # web
- Verify that the rules are fine “$ shorewall check”
- Edit /etc/default/shorewall and set startup to 1
# prevent startup with default configuration
# set the following varible to 1 in order to allow Shorewall to start
startup=1
- Start the firewall “$ /etc/init.d/shorewall start”
If you later decide to update rules, zones etc run “$ /etc/init.d/shorewall restart” to load the changes.
Tags: debian, firewall, shorewall, ubuntu
Posted in debian, shorewall, ubuntu | No Comments »
Friday, January 29th, 2010
A fairly common issue on the Internet is that some routers can’t handle window scaling.
This will might give some odd messages to email servers (such as not being able to send mails over a certain size to one receiving mail server)
On option is to turn off window scaling by editing sysctl.conf and adding the following lines
# Uncomment to turn off window scaling (most usefull for linux MTA)
net.ipv4.tcp_window_scaling = 0
A warning about doing this; In the long run throughput will not be optimal on this server, but sending mails should work better (so best used on a dedicated mail server).
Tags: kernel, mail, mailserver
Posted in linux | No Comments »
Tuesday, January 26th, 2010
To install magento on a fresh server use the following.
- Install apache, mysql and PHP5 “$ apt-get install apache2 mysql-server php5 php5-mysql php-soap php5-mcrypt php5-curl php5-gd”
- Edit the vhost config for the apache site [/etc/apache2/sites-enabled/000-default]
- Verify that “AllowOverride” is set to All for the magento directory
- Make sure that mof_rewrite is loaded; use “$ a2enmod rewrite” and then reload apache2
- Edit /etc/php5/apache2/php.ini
- “memory_limit” [the manual says] no less than 256Mb (preferably 512)
- “max_execution_time” [this is the max time that a script may be left running] SOAP requests take time, so make suer it is at a reasonable time
- “upload_max_filesize” Set this to a size that is reasonable depending on what you plan to upload (manuals might be large)
- “post_max_size” Set this to a size that is reasonable depending on what you plan to post (manuals might be large); also make sure that the value and the modifier is correct (so that it says 8M and not just 8 for instance)
- “display_errors” Set to Off
- “log_errors” Set to On
- “error_log” Set to a file that you will be able to find [if you wish to have it in a subdir; create that as root and give it permissions as apache log dir]
- download magento (lastest version from magento
- Upack it (I choose bzip2 format) “$ tar -jxvvf magento-downloader-1.3.2.1.tar.bz2″ and make sure the files gets put in the directory you wish
- Some directories have to be writable to the webserver (and all subdirectories, where there are)
- var
- var/.htaccess
- app/etc
- media
- If you are using the downloader installation
- “$./pear mage-setup .”
- “$./pear install magento-core/Mage_All_Latest”
- “$rm -rf downloader/pearlib/cache/* downloader/pearlib/download/*”
- Create database and database user [this is to do it manually via mysql console]
- “$mysql -uroot -p”
- “mysql> create database magento;”
- “mysql> use mysql;”
- “mysql> INSERT INTO user (Host,User,Password) VALUES (‘localhost’, ‘magento’, PASSWORD(‘password’));”
- “mysql> GRANT ALL ON magento.* TO ‘magento’;”
- “mysql> FLUSH PRIVILEGES;”
- “mysql> exit”
- Go to the webserver and complete the installation
- If you get stuck on the configuration page [that you get back to it even after adding correct information]:
- Check “AllowOverride” in the apache config.
- Check “post_max_size2 in the php.ini [also check so that the value is either absolute or has a modifier; 8 means 8 bytes while 8M means 8Mb]
Tags: install, installing, Magento
Posted in debian, Magento | 1 Comment »