[FreeBSD] Jail Setup - BSD
Users browsing this thread: 1 Guest(s)
|
|||
|
Install a Secure Web Server (nginx) in a FreeBSD jail: ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ For this tutorial, you'll learn how to setup a jail on a FreeBSD system and install a web server with php, mysql. -- You must know UNIX basic commands and have the FreeBSD source installed. To install a port, use "make install clean". You can also use "make config-recursive install clean" to get all configure options prompted at the beginning, which can be useful for big ports. 1. JAIL ¯¯¯¯¯¯¯¯ First, make sure you have a compiled the FreeBSD world. If not, in /usr/src: PHP Code: This might take a couple of hours. Never forget that you can do some optimisations in /etc/make.conf or decide to not build some modules and/or options in /etc/src.conf. When FreeBSD's userland is compiled, we'll make the Jail directory and install the system: We'll call the jail "jail0", you can call it whatever you want. PHP Code: The jail is installed. Now we have to put some information in our /etc/rc.conf: PHP Code: You have to make an alias or choose a network interface for the jail. ( in my case, i have only one ethernet port. ) Also in /etc/rc.conf: PHP Code: Make the alias: PHP Code: interface is, run "ifconfig -a" :). So now your jail, "jail0" should be started at boot, but you can also start it directly with: PHP Code: First, execute a: PHP Code: ( Jail LiSt ) The output should look like this: PHP Code: You can enter in it with jexec: ( tool to execute processes in jails ) -> jexec 1 sh | The process to execute, here sh will give us a shell ID of the jail. JID You can now check that you are in the jail by typing jls. (should return an empty list) Check that you have an active internet connection. But don't use ping, it won't work. Try, for example, to install something you need, like: PHP Code: If it doesn't work, check ifconfig -a and this should be in your jail's /etc/rc.conf: PHP Code: Restarting or shutting down a jail can't be done like on your main system, but you can execute: PHP Code: ( there is also an application in ports called jkill { /usr/ports/sysutils/jkill } that can help ) At this point, you should have an internet connection working. You might want to set root's password with "passwd" and set the timezone: PHP Code: Mount procfs, run: PHP Code: -> write that in jail's /etc/fstab: \__ |proc /proc procfs rw 0 0 | ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ |
|||
|
|||
|
Great tutorial! :D But I think you should do something for the PHP code coloring, it is really hard to read on this dark background.
|
|||
|
|||
|
Yeah, I need to fix that.
|
|||