NOTES/reference

[ HOME | REFERENCE | FreeBSD | MySQL | PostgreSQL | Apache | qmail | PHP | Pure-FTPd ]

introduction

Check this page for references or hints to help you along your way with the install, setup, configuration.


.vimrc

2003/07/12

I've been using FreeBSD for well over two years, and only recently I moved over to one of the most common editors in the *nix world: vim. It's like vi but improved. I'm moving away from ee, but I'll leave ee as the editor in the NOTES. The following is my ~/.vimrc:

:syntax enable

set et
set shiftwidth=4
set tabstop=4
set smarttab
set expandtab
set ai

set background=dark

set t_kD=^V<Delete>
set backspace=indent,eol,start

set ruler
set secure
set showcmd
set showmode

set fileformat=unix
set linebreak

set textwidth=0
set showbreak=+
set viminfo='1000,f1,\"500
set virtualedit=all

Since I use PuTTY to connect to my FreeBSD machines, be sure you set your Backspace key to Control-H. Everything should be working fine after that (both in bash and in vim).


cardboard.tar.bz2

v.0.50 - 2005/12/28

Use the cardboard script to get NOTES completed as fast as possible. I do not recommend anyone who has not gone through NOTES at least once to execute cardboard. It is the easiest way to get the server up and running, but you may not be too sure how your server works. That is why I recommend going through NOTES once through the hard way.

This script must be executed after FreeBSD has been installed and configured. That means the FreeBSD section of NOTES should be complete. Use the t.post.tar.bz2 script to speed up the process.

As root, fetch it

# fetch http://notes.twinwork.net/bin/cardboard.tar.bz2

Extract it

# tar yxfv cardboard.tar.bz2

cd to the cardboard directory

# cd cardboard

Before running stream.sh, you might want to edit the file first. After you are done, go ahead and execute it

# sh stream.sh

Get a cup of coffee and let it compile. The latest version of cardboard needs some user intervention. There are a number of ports that asks for user options and the script will not continue until you choose those options. That is why you should be at least somewhat familiar with NOTES otherwise you will not know what options to choose.

After stream.sh finishes its thing, there are a number of places in NOTES you need to check to make sure your server configuration is complete.

-- mysql, iii. start the server & iv. privileged user
Be sure to start your MySQL server and change the appropriate passwords and add the appropriate users.

-- postgresql, iii. edit configuration files
You'll need to edit /usr/data/pgsql/postgresql.conf, and /usr/data/pgsql/pg_hba.conf.

-- postgresql, iv. start the server & v. create privileged user & test database
You'll need to start the PostgreSQL server. Then add your privileged users and databases.

-- qmail, iv. more configuration
You do not need copy the base web files for qmailadmin. You do not need to create vpopmail entries in MySQL. Instead, edit /usr/local/vpopmail/etc/tcp.smtp, reload tcp.smtp, be sure to chmod vchkpw correctly, and edit root's crontab for clearopensmtp.

-- qmail, v. kill sendmail
Proper linking of sendmail to qmail is complete. You need to edit /etc/rc.conf to make sure sendmail doesn't start, and be sure you do killall sendmail.

-- qmail, vi. add domains
Review this section to add domains.

-- apache, i. ports
Review the last half of this section to edit /etc/httpd.conf.

-- apache, iv. virtual hosts & v. logging
Review both of these sections. By the way, your default website has been properly linked and created.

-- php, ii. configure
Edit /etc/httpd.conf and add the AddType for php.

You might to review the entire NOTES to make sure nothing is missing. Actually, you should review stream.sh so you can see what has been installed, copied, configured and what hasn't. If everything is properly setup, then start your services and Apache.

# /usr/local/etc/rc.d/svscan.sh start
# /usr/local/etc/rc.d/apache2.sh start

You're done!

That said, this script is still in its beta state. It's quick and dirty and must be executed from within the cardboard directory.

Please note that cardboard sets vpopmail to use MySQL.

Also, PureFTPd is not installed! The PureFTPd section in NOTES is still being worked on and is not complete. Therefore, it is not part of cardboard.


find

The easiest to find a file would be using the find command.

$ find / -name foo

This looks for a file named foo starting from the root directory and searches all the way through.

Check man find for more information.


freebsd-update

In the FreeBSD NOTES, keeping the world to the latest updates can be a long process. It requires updating the source and building the world. Of course, there's a quicker way to do this if you don't care about building from the source. Just use the freebsd-update utility to use binary updates.

Copy freebsd-update.conf to /etc

# cp /usr/share/examples/etc/freebsd-update.conf /etc/

Fetch the latest patches for your system.

# freebsd-update fetch

After that is complete, install it.

# freebsd-update install

You will need to reboot your system in order to see the updates in your patched kernel via uname -a.


get_pageversion()

This function may be a bit out of place. This has nothing to do with FreeBSD, MySQL, Apache, qmail, PHP, or Pure-FTPd. But it does deal with NOTES. This function is used on the bottom (and top, if you check the source in the HTML comments) of every page on NOTES. It retrieves the page version, last modified date, and more.

I put this function up for visitors who are interested in how NOTES work. I got sick and tired of modifying the dates manually. I knew there was an easier way, so I took a night to think it through and this PHP function was the result.

Take a look :)

array get_pageversion(database resource link);

Feel free to use and modify it. Again, don't blame me if it doesn't work or blows up your server if you use it. It uses MySQL and sessions.


ident for IRC

If you need to enable ident for IRC, uncomment and edit a line in /etc/inetd.conf

# ee /etc/inetd.conf

At around Line 99, uncomment and edit it to look like the line below

auth stream tcp nowait root internal auth -d link -rgo UNIX

I know you can't see the TABS above, but use /etc/inetd.conf as a reference of where to keep the TABS. Send a HUP signal to inetd to restart it.

# killall -HUP inetd

That's it! Now you have a working ident for IRC!


q.notes.tar.bz2

As mentioned in the qmail NOTES, this script takes care of part three, scripts.

# fetch http://notes.twinwork.net/bin/q.notes.tar.bz2

Extract it

# tar xyfv q.notes.tar.bz2

Change into the q.notes directory

# cd q.notes

And execute this once

# sh populate.sh

Part three of qmail NOTES is complete! Now finish up the rest of the NOTES.


shutdown -p now

This command will shutdown your computer and power it down once the shutdown process is complete. Prior to FreeBSD 5.3, I had to jump through hoops in order to power down the computer. This included messing with your kernel by adding acpi or apm options or messing with /etc/sysctl.conf. All you need to do now (in FreeBSD 5.3 or later) is execute the following command

# shutdown -p now

If you are like me, then you may be dealing with old hardware which you know the motherboard BIOS support ACPI. I took a look at /usr/src/UPDATING and it mentions that ACPI is automatically disabled if your motherboard BIOS has been blacklisted. You can find the blacklist message in dmesg if you notice ACPI is not enabled.

If you do not want to update your motherboard BIOS... which you should... but then again, if you are like me you will want to override to enable ACPI for "testing" purposes. You will need to edit /boot/device.hints

# vi /boot/device.hints

Add the following line

hint.acpi.0.disabled="0"

Since this file is read-only, use the following command to force write and quit the editor.

:wq!

If you are not familiar with vi or vim, press ^C (that would be Ctrl+C) then type the above.

Now you can reboot and your computer should have ACPI enabled!


tar

This is the simplest method of creating a tar archive.

$ tar cfv archive.tar directory

The flags mean create file verbally. Extracting it is nearly identical.

$ tar xfv archive.tar

The flags mean extract file verbally.

This creates and extract tar archives without any compression.

To create one with gunzip compression

$ tar czfv archive.tar.gz directory

To extract a gunzip tar archive

$ tar xzfv archive.tar.gz

The z flag between create/extract and file is for gunzip.

gunzip compression isn't as good as bzip2. To create a bzip2 tar archive, change the z flag to y.

$ tar cyfv archive.tar.bz2 directory

And to extract

$ tar xyfv archive.tar.bz2

Note: All extractions extract to the current working directory.

Check man tar for more information.


t.post.tar.bz2

v.1.06 - 2008/09/02

As mentioned at the end of the FreeBSD post installation section, this script will do much of the installation (and then some) and configuration mentioned in NOTES. This is a very simple (and cheap) shell script. Be sure to read it over and use it at your own risk!

It does a myriad of dirty work for you which includes:

Now, grab the script from NOTES. As root

# fetch http://notes.twinwork.net/bin/t.post.tar.bz2

Extract it

# tar xyfv t.post.tar.bz2

Change to the t.post directory

# cd t.post

You do not need to make this script executable since you should only run it once. So run it

# sh post-install.sh

Read it.

Enter a name for your custom kernel.

Enter the cvsup server closest to you. Be careful using the default cvsup server, it may be crowded. I suggest checking the mirror list of cvsup servers that are available to you.

If you read the post-install.sh shell script itself, you'll notice it's very messy and simple. There is no error checking. You must execute this script in the t.post directory otherwise it won't find the root.profile and skel.dot.profile it needs. If not, the script will fail and you're left with a mess.

After it is complete, exit and log back in to see root's new shell prompt. Then you will need to add a new user, edit /etc/make.conf, and edit your custom kernel. Everything in the FreeBSD NOTES after the kernel hasn't been touched by the script and should be looked over.

This script is for 7.0-RELEASE.

Good luck!



Valid XHTML 1.0!QUESTIONS/COMMENTS/CORRECTIONS? notes@twinwork.net
$NOTES: /reference/, v.0.32 2010/12/11 13:44:35 PST /6991/ NkM$
Maintainer: Neafevoc K. Marindale