Friday, July 24, 2009

FreeBSD - Ncurses menu config location

So something cool -

In FreeBSD when you install a port and encounter a ncurses ui and then hit ok, where does it go?


check it out some time :D

Thursday, July 23, 2009

FreeBSD - Installing postfix & sending your first mail

Postfix: Probably the premier replacement for sendmail, which comes with ux/linux.

$> cd /usr/ports/mail/postfix-current/
$> make install clean

At this point you will most likely be confronted by a ncurses menu. You can choose to enable options or not. We just want to go with stock options so tab to ok and hit enter. So this should just go on and do its marry thing. If you get any other boxes just stick with defaults and tab to ok, and install.

Now to test!

telnet to your local host on port 25, and then type the following:
$> telnet localhost 25


*After this you should get accouple messages that start with 250 - this is good!*

mail from:

*another 250 message*

rcpt to: type_your_email_address_here_instead_of_this

*another 250 message*


*another message*

subject: This is a test message!!!
test message

*message about being queued*


* This will exit telnet, and we will sleep the following command for a minute to check your mail log to see if its been sent *
$> sleep 60 && tail /var/log/maillog | grep sent

if it comes back with sent your gold and you've sent your first message.

**** Just a side note, this is how it works in linux - infact i had to configure linux more then bsd

Please respond if you have issues :)

FreeBSD - Adding/setting up Grub

So your from linux land or you just want to try something new... Try grub :)

Lets located grub:
#> whereis grub

Move to grubs port directory and install it:
#> cd /usr/ports/sysutils/grub
#> make install clean

Make the Mbr writeable, which is needed for grub:
#> sysctl kern.geom.debugflags=16

Now for the fun part! Installing - if you have a basic install this work just fine
#> grub-install hd0
Entering the grub subsystem:
#> grub
grub> root (hd0,0,a)
grub> setup --stage2=/boot/grub/stage2 --prefix=/boot/grub (hd0)
grub> quit

Making a menu.lst file that will take you to a free bsd booter.
#> nano /boot/grub/menu.lst

title FreeBSD 7.2
root (hd0,0,a)
kernel /boot/loader

Reboot the box and cross your fingers ;)

So I hope this worked for you, it worked great on my VM machine, and a few other boxes i've installed.

Wednesday, July 22, 2009

FreeBSD - Adding/setting console to Bash

Mind you after the fresh install you will probably have to do this as your root user until you install su or sudo.

$ echo $SHELL
$ cd /usr/ports/bash3/
$ make install clean
~ This will download extra components && files ~
$ chsh -s bash root
$ chsh -s bash $USER
$ exit

~ Relogin and verify ~

# echo $SHELL

^_^ you now have bash shell!

Tuesday, July 21, 2009


This cleans your source.list file, and then replaces the repos for debian 4 you can probably replace etch with lenny to update debian 5 boxes. It also accounts for the debian keyring update that recently occured


# Designed to fix the repos on a legacy debian box.
# By L.C.

apt-get clean all ;
cat > /etc/apt/sources.list <# New Repo list
deb etch main
deb-src etch main
deb etch/updates main contrib
deb-src etch/updates main contrib
apt-get -y --force-yes install debian-archive-keyring && apt-get update && apt-get -y --force-yes upgrade ;

Apt_ctrl - When yum isnt your thing.

Apt_ctrl or Apt Control -

This was really designed to simplify package management by myself. The initial implement came about as a response to those vendors out there whom like to remove yum, but later on even with yum reinstalled... well things just weren't all right. So..? I dev'd out this monster to attempt to bring some sainity. Granite this is not the end to the pain and suffer and yes it only works for Centos 5 atm and will probably only remain in support of centos until the need arises to move to fedora.
Give it a shot you might like it.


### Apt Control ###
# Written by L.C. to reduce the suffering of a Centos5 install.

# installs coreutils
yum install coreutils -y;
# sets the redhat release to a variable - maybe later they will change the location of this file?
# acquiring the Architecture
plat_arch=`uname -i`
# determines OS
plat_os=`cat $rh_file | cut -d" " -f1`
if [ $plat_os == CentOS ] ;
then plat_type=el ;
else plat_type=fc ;
# Creates the release for the link - ie centos 5 = el5
plat_release=$plat_type`cat $rh_file | cut -d"." -f1 | cut -d' ' -f3`
# All variables get pulled into the link and then we request the file & install it
rpm -Uhv$plat_release/en/$plat_arch/rpmforge/RPMS/rpmforge-release-0.3.6-1.$plat_release.rf.$plat_arch.rpm
# we clean current repo's of potentially crappy data
yum clean all;
# we now do a fresh install of Apt-get
yum install apt -y;
# we echo commands into the os.list file to provide repos
echo 'repomd centos/$(VERSION)/os/$(ARCH)' > /etc/apt/sources.list.d/os.list &&
echo 'repomd centos/$(VERSION)/updates/$(ARCH)' >> /etc/apt/sources.list.d/os.list &&
echo 'repomd centos/$(VERSION)/extras/$(ARCH)' >> /etc/apt/sources.list.d/os.list &&
echo 'repomd centos/$(VERSION)/fasttrack/$(ARCH)' >> /etc/apt/sources.list.d/os.list ;
# we now update our package list
apt-get update;
# we next will install required packages.
apt-get -y install php php-curl php-mysql php-cli postfix mysql-server php-pgsql nano screen mc vixie-cron rkhunter;

scron - A cron replacement

This piece below was designed a replacement to cron, because VPS's/VDS's were/are broken and eventually cron dies. So I coded up this installer with ideas and assistance from a co-worker for "Script Cron" or Scron to take the place of the broken vixie-cron and other crons.



## SCron - When normal cron just isnt working ##
# Written by L.C. and R.P.

## This section builds all of scrons directories and scron.
echo "Generating directories for scron.. "
mkdir /usr/local/scron ;
chmod 700 /usr/local/scron ;
mkdir /usr/local/scron/jobs ;
chmod 700 /usr/local/scron/jobs ;
echo "Building Scron.. "
cat > /usr/local/scron/ <<\EOF
#Scron - The 5 minute man
while [ 1 -eq 1 ]; do
for a in /usr/local/scron/jobs/*.sh; do
sleep 300
chmod 700 /usr/local/scron/ ;
chattr +a +i /usr/local/scron/ ;
echo "Creating custom rc.local.. "
cat > /etc/rc.local <#!/bin/bash
# Scron custom RC.Local
screen -dmS loop /usr/local/scron/
exit 0
## This section is for jobs optionally created upon install.
echo "Generating jobs that will run split_q and fail_restart... "
cat > /usr/local/scron/jobs/ <#!/bin/bash
# Script to run split_q.php
php /usr/local/sendstudio/split_q.php
chmod 700 /usr/local/scron/jobs/
cat > /usr/local/scron/jobs/ <#!/bin/bash
# Script to run fail_restart.php
php /usr/local/sendstudio/cron/fail_restart.php
chmod 700 /usr/local/scron/jobs/ ;
## Patch so it will run cli send regardless of
## screen sessions.
cat > /usr/local/sendstudio/cron/ <<\EOF
screen -ls |grep send > /dev/null
if [[ $? == 0 ]]; then
screen -S send -d -m php /usr/local/sendstudio/clisend.php
## since we have some custom cron jobs initially installed with
## our production installer we remove them.
echo "copying the maint script.. "
cp /usr/local/sendstudio/ /usr/local/scron/jobs/
echo "removing old cron.. "
rm -rf /etc/cron.d/obey
## Reboot at the end - optionally you could just run the same
## command in rc.local.
echo "Going down for a reboot"
init 6 ;


Sipie - what can I say? Sirius radio via terminal woot woot.

I've done a few installs of this product, and it seems at a stand still. You can use gui with it if you install the correct packages. I've found that you get differing results amongst the installs.

Ubuntu 9.04 - just install requirements and get python2.4 & python2.5 - make sure you grab the older beautifulstonesoup and stick it in sipie's directory it totally hates the new one.

$> sudo apt-get install mplayer python-setuptools python-wxgtk2.6 subversion
$> svn co sipie
$> cd sipie/

~~~ Install it ~~~~

$> wget
$> tar zxvf BeautifulSoup-3.0.7.tar.gz
$> cd BeautifulSoup-3.0.7/
$> cp BeautifulSoup.* ~/sipie/

Ideal way to execute this is probably insert something into your .bashrc .

echo 'alias sipie="python2.4 /home/$USER/sipie/"' >> /home/$USER/.bashrc

$>sipie octane


**** Fedora 10 - I almost got this to work perfectly with updating my system and installing system requirements.

This will require: rpmfusion/forge for non-free software.

**** Python 2.6 & 3.0 seem to just hate this app btw so I wouldnt bother. I installed as far back as 2.3 aswell, but 2.4 seemed best.