Install Apache In Freenas Jail Host

Select Install/Upgrade. Select the spare USB drive (FreeNAS will not install on the one containing the OS so fear not if you select the wrong one) with the spacebar. Enter a root password. I have been trying to get more use out of my freenas file server. This is the first tutorial I have found that has worked for building a working Apache server for an internal website. Thank you for maintaining this page. If possible can you point me in the direction of a tutorial for setting up the ftp connections for installing themes.

I had some free time this weekend and decided to upgrade my FreeNAS. I went from 11.1 to 11.3-UI and the upgrade installed without any issues. However, after the reboot I discovered that my jails and plugins were missing from the UI and that they were not running. I had read the manual (FreeNAS® 11.3-U1 User Guide) before the upgrade and and the instructions did not mention anything about the plugins, so I was little worried.

  • No jail is created because the DNS fails during the use of the plugin install and everything is rolled back by freenas. Any portion of the plugin setup that requires the jail to do DNS lookups fails. The documentation states that resolv.conf is inherited from the host. That doesn't appear to be happening for the jail.
  • — Install Apache. The Apache web server is currently the most popular web server in the world.
  • # you may have to install curl and nano and some other tools into the jail pkg install curl wget nano curl localhost:8086/query -data-urlencode 'q=show databases' Step 3: create the databases We’ll need 2 databases: one that will receive collectd data from the various rasperry pi’s and other things that support collectd, and one that will.

After spending a lot of time researching I discovered that on FreeNAS 11.2 the project started to use the ‘iocage’ jail method instead of ‘warden’. FreeNAS 11.2 had the option of migrating your jails, and it could even display then from the UI. But for 11.3-UI that was no longer an option.

If you are on the same boat as me, the instructions below will help you quickly re-create a new Plex jail a move your old data to the new jail. If you have not upgraded to 11.3-UI you might want to convert your jail before upgrading. There are a lot of tutorials on-line on how to convert your jail that might be more useful to you.

Instructions

a. Create the plex user with UID 972 (this is the username and UID that is used by the project)

b. If desired, create a new Dataset to have Plex data outside of the plugin Dataset. I won’t go into details for this type of setup here as I keep my Plex data inside the Plex plugin Dataset

c. Install the ‘Plex Media Server’ plugin (official instructions)

d. Stop the plugin

e. Go to ‘Storage => Pools’ and edit the ACL for the Dataset where your media is saved. We want to give access to the ‘plex’ user (in case the files are not owned by ‘plex’)

f. With the plugin still stopped, copy the old installation data folder from the old plugin Dataset to the new plugin Dataset

Note: The JAIL_ROOT location will vary between different FreeNAS versions:

Freenas Jail Upgrade

  • FreeNAS 11.1 and bellow (warden) - JAIL_ROOT=/mnt/[Volume]/jails/[JAIL_NAME]
  • FreeNAS 11.2 and above (iocage) - JAIL_ROOT=/mnt/[Volume]/iocage/jails/[JAIL_NAME]

Source for your old Plex plugin (warden)

If installed manually

${JAIL_ROOT}/root/usr/local/plexdata/Plex Media Server/

If installed via plugin

${JAIL_ROOT}/var/db/plexdata/Plex Media Server/

Destination (iocage)

${JAIL_ROOT}/root/Plex Media Server/

g. In the jails configuration menu, select the new Plex jail and add the mount point for the media folder. Try to keep the same path as the old jail so you won’t have to edit your library. If you don’t remember that the path was, you can access it by looking at the contents of /mnt/[Volume]/jails/.[JAIL_NAME].meta/fstab

h. Start the plugin and try to access it via web

References:

Tutorial

Introduction

A FAMP stack, which is similar to a LAMP stack on Linux, is a group of open source software that is typically installed together to enable a FreeBSD server to host dynamic websites and web apps. FAMP is an acronym that stands for FreeBSD (operating system), Apache (web server), MySQL (database server), and PHP (to process dynamic PHP content).

In this guide, we’ll get a FAMP stack installed on a FreeBSD 10.1 cloud server using pkg, the FreeBSD package manager.

Prerequisites

Before you begin this guide, you should have a FreeBSD 10.1 server. Also, you must connect to your FreeBSD server as a user with superuser privileges (i.e. is allowed to use sudo or change to the root user).

Step One — Install Apache

The Apache web server is currently the most popular web server in the world, which makes it a great choice for hosting a website.

We can install Apache easily using FreeBSD’s package manager, pkg. A package manager allows us to install most software pain-free from a repository maintained by FreeBSD. You can learn more about how to use pkg here.

To install Apache 2.4 using pkg, use this command:

Enter y at the confirmation prompt.

This installs Apache and its dependencies.

To enable Apache as a service, add apache24_enable='YES' to the /etc/rc.conf file. We will use this sysrc command to do just that:

Now start Apache:

You can do a spot check right away to verify that everything went as planned by visiting your server’s public IP address in your web browser (see the note under the next heading to find out what your public IP address is if you do not have this information already):

You will see the default FreeBSD Apache web page, which is there for testing purposes. It should say: “It Works!”, which indicates that your web server is correctly installed.

How To find Your Server’s Public IP Address

If you do not know what your server’s public IP address is, there are a number of ways that you can find it. Usually, this is the address you use to connect to your server through SSH.

If you are using DigitalOcean, you may look in the Control Panel for your server’s IP address. You may also use the DigitalOcean Metadata service, from the server itself, with this command: curl -w 'n' http://169.254.169.254/metadata/v1/interfaces/public/0/ipv4/address.

A more universal way to look up the IP address is to use the ifconfig command, on the server itself. The ifconfig command will print out information about your network interfaces. In order to narrow down the output to only the server’s public IP address, use this command (note that the highlighted part is the name of the network interface, and may vary):

Now that you have the public IP address, you may use it in your web browser’s address bar to access your web server.

Step Two — Install MySQL

Now that we have our web server up and running, it is time to install MySQL, the relational database management system. The MySQL server will organize and provide access to databases where our server can store information.

Again, we can use pkg to acquire and install our software.

To install MySQL 5.6 using pkg, use this command:

Enter y at the confirmation prompt.

This installs the MySQL server and client packages.

To enable MySQL server as a service, add mysql_enable='YES' to the /etc/rc.conf file. This sysrc command will do just that:

Now start the MySQL server:

Now that your MySQL database is running, you will want to run a simple security script that will remove some dangerous defaults and slightly restrict access to your database system. Start the interactive script by running this command:

The prompt will ask you for your current root password (the MySQL admin user, root). Since you just installed MySQL, you most likely won’t have one, so leave it blank by pressing RETURN. Then the prompt will ask you if you want to set a root password. Go ahead and enter Y, and follow the instructions:

For the rest of the questions, you should simply hit the RETURN key at each prompt to accept the default values. This will remove some sample users and databases, disable remote root logins, and load these new rules so that MySQL immediately respects the changes we have made.

At this point, your database system is now set up and we can move on.

Step Three — Install PHP

PHP is the component of our setup that will process code to display dynamic content. It can run scripts, connect to MySQL databases to get information, and hand the processed content over to the web server to display.

We can once again leverage the pkg system to install our components. We’re going to include the mod_php, php-mysql, and php-mysqli package as well.

To install PHP 5.6 with pkg, run this command:

Enter y at the confirmation prompt. This installs the php56, mod_php56, php56-mysql, and php56-mysqli packages.

Now copy the sample PHP configuration file into place with this command:

Now run the rehash command to regenerate the system’s cached information about your installed executable files:

Before using PHP, you must configure it to work with Apache.

Install PHP Modules (Optional)

To enhance the functionality of PHP, we can optionally install some additional modules.

To see the available options for PHP 5.6 modules and libraries, you can type this into your system:

The results will be mostly PHP 5.6 modules that you can install. :

To get more information about each module does, you can either search the internet, or you can look at the long description of the package by typing:

There will be a lot of output, with one field called Comment which will have an explanation of the functionality that the module provides.

For example, to find out what the php56-calendar package does, we could type this:

Install Apache In Freenas Jail Host

Along with a large amount of other information, you’ll find something that looks like this:

If, after researching, you decide that you would like to install a package, you can do so by using the pkg install command like we have been doing for the other software.

For example, if we decide that php56-calendar is something that we need, we could type:

If you want to install more than one module at a time, you can do that by listing each one, separated by a space, following the pkg install command, like this:

Step Four — Configure Apache to Use PHP Module

Before Apache will process PHP pages, we must configure it to use mod_php.

Open the Apache configuration file:

First, we will configure Apache to load index.php files by default by adding the following lines:

Next, we will configure Apache to process requested PHP files with the PHP processor. Add these lines to the end of the file:

Save and exit.

Now restart Apache to put the changes into effect:

At this point, your FAMP stack is installed and configured. Let’s test your PHP setup now.

Step Five — Test PHP Processing

In order to test that our system is configured properly for PHP, we can create a very basic PHP script.

Freenas Ssh Into Jail

We will call this script info.php. In order for Apache to find the file and serve it correctly, it must be saved under a very specific directory–DocumentRoot–which is where Apache will look for files when a user accesses the web server. The location of DocumentRoot is specified in the Apache configuration file that we modified earlier (/usr/local/etc/apache24/httpd.conf).

By default, the DocumentRoot is set to /usr/local/www/apache24/data. We can create the info.php file under that location by typing:

This will open a blank file. Insert this PHP code into the file:

Save and exit.

Install Apache In Freenas Jail Host Command

Now we can test whether our web server can correctly display content generated by a PHP script. To try this out, we just have to visit this page in our web browser. You’ll need your server’s public IP address again.

The address you want to visit will be:

The page that you see should look something like this:

This page basically gives you information about your server from the perspective of PHP. It is useful for debugging and to ensure that your settings are being applied correctly.

If this was successful, then your PHP is working as expected.

Install Apache In Freenas Jail Host Access

You probably want to remove this file after this test because it could actually give information about your server to unauthorized users. To do this, you can type this:

You can always recreate this page if you need to access the information again later.

Install Drivers Freenas

Freenas

Conclusion

Freenas Jail Network

Now that you have a FAMP stack installed, you have many choices for what to do next. Basically, you’ve installed a platform that will allow you to install most kinds of websites and web software on your server.

Install Freenas On Freebsd

If you are interested in setting up WordPress on your new FAMP stack, check out this tutorial: How To Install WordPress with Apache on FreeBSD 10.1.