install booked on centos

18
Installing Booked scheduler on CentOS 6.5 This guide will assume that you already have CentOS 6.x installed on your computer, I did a plain vanilla “Desktop” install into a Virtual Box VM for this test, should be the same for most real metal installations. This should also work for some of the minimum installs on the CentOS installer disk, but it has not been tried. Most of it is command line and it pretty well picks up right after you make your first (forced) user account. I used sudo for everything as opposed to logging in as the root account which is probably pretty common for most hosting companies. You will need some sort of elevated privileges in order to make this install, ability to install packages, change permissions on files, etc. So lets start at the beginning, log in as your user account and open a terminal, we are going to set up the user account to be able to assume full control. Type: su followed by the root user's password that you created when you installed the OS Now type the following to edit the sudoers file: vi /etc/sudoers 1

Upload: dangbao

Post on 05-Jan-2017

240 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Install Booked on CentOS

Installing Booked scheduler on CentOS 6.5

This guide will assume that you already have CentOS 6.x installed on your computer, I did a plain vanilla “Desktop” install into a Virtual Box VM for this test, should be the same for most real metal installations. This should also work for some of the minimum installs on the CentOS installer disk, but it has not been tried. Most of it is command line and it pretty well picks up right after you make your first (forced) user account. I used sudo for everything as opposed to logging in as the root account which is probably pretty common for most hosting companies. You will need some sort of elevated privileges in order to make this install, ability to install packages, change permissions on files, etc.

So lets start at the beginning, log in as your user account and open a terminal, we are going to set up the user account to be able to assume full control.

Type:sufollowed by the root user's password that you created when you installed the OS

Now type the following to edit the sudoers file:vi /etc/sudoers

1

Page 2: Install Booked on CentOS

Should look like the following:

Page down until you see the root account permissions, press “i” to get into insert mode, and add your user name in the same format as the root account above:

username (tab) ALL=(ALL) (tab) ALL

This gives you full control, there are many other levels that should work, but I was lazy and just gave myself full control. Press the escape key to get out of insert and back into command mode. Type:

:w!

to save the document and overwrite the read only file. Then quit (:q!) and you will return back to the terminal. To test give the following a try:

sudo yum update

2

Page 3: Install Booked on CentOS

And you should get something like the following:

Type your user account password and it should either update or say that no updates were needed, mine needed a bunch of updates since it was a fresh install.

If you needed updates, let that churn through the system and finish, might take a while depending on your connection to the internet and the speed of your computer. Now on to the installation of the packages we need, then the configuration of a few items.

3

Page 4: Install Booked on CentOS

NOTE: I have been advised that the use of phpmyadmin can be a security risk. Adding the EPEL repository is only needed if you are going to add phpmyadmin. If you decide not to install phpmyadmin, skip this step.

Back in the terminal we need to start installing some packages, depending on the version of install you used, some of these might be installed already, but it is a good idea to go through and run the installs anyway, YUM will tell you if there is nothing to do. The first thing we need to do is install the Extra Packages for Enterprise Linux (epel). Type:

sudo rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

When it finishes check to see if it is installed be typing:

sudo yum repolist

You should see the epel repository listed with any other repos that you have installed, as you can see I only have the basic built in repos plus the epel repo installed. You also should have noticed that you didn't need to type your password again, sudo caches this for 15 minutes to save you some time.

On to the other things...

4

Page 5: Install Booked on CentOS

Type:

sudo yum install httpd

This is the Apache web server, on my machine it was already installed so it looked like this:

Move on to the other things and run them through.

sudo yum install mysql mysql-server

sudo yum install php php-mysql

sudo yum install phpmyadmin *see note above about phpmyadmin, it is not a required package

If you get any additional dialog boxes, you can pretty much just answer (Y)es.

Now that we have everything installed, we need to start some services and check to make sure things work. We'll start Apache and set it to start automatically at boot, again back in terminal:

sudo service httpd start

Since I don't have any DNS servers set up, I get the error that it can't determine the server name, not a big deal right now, you can fix this by making sure your DNS server has the correct information pointing to your Booked server, or you can edit the /etc/hosts file to point to your Booked server (shown later in this guide). Now make the service start at boot:

sudo chkconfig httpd on

5

Page 6: Install Booked on CentOS

Moving on to mysql we type similar commands:

sudo service mysqld start

Again it looks like lack of a DNS server causes grief, something that will need to be sorted out and may require a bit of config file editing down the road. The short term goal is getting all this working locally (127.0.0.1), there should be plenty of other guides on getting those other configuration settings correct. You should see the last line in the terminal stating Starting mysqld: [ OK ] if it fails, you will get some kind of error code that you should be able to look up. Again proper DNS entries or hosts file entries will remove the errors about can't find the correct name. Follow starting the service by again telling it to start at boot:

sudo chkconfig mysqld on

Every once in a while we will need to restart these servers, after making a few additions or adjustments it is wise to do this. Commands are:

sudo service httpd restart

sudo service mysqld restart

We should probably test a few things now and see what works, open a browser and type into the address bar:127.0.0.1

It should look something like this:

6

Page 7: Install Booked on CentOS

Back to terminal, we need to create a file to test php, type:

sudo vi /var/www/html/testphp.php

The vi editor will open and give you a blank document. Type (insert with the “i” key):

<?phpphpinfo ();?>

ESC and :w and :q!

Now type:

sudo service httpd restart

and then go to your browser and type in the address bar:

127.0.0.1/testphp.php

and you should see the PHP status page

7

Page 8: Install Booked on CentOS

We need to set up the mysql parts, so we need to go back to terminal and type:

sudo mysql_secure_installation

You will follow the on screen prompts to set up the root password and do some cleanup. Answer (Y)es to pretty much everything unless you want to manage it over the web, but that takes other considerations and will need to be researched before allowing remote connections.

Restart the server:

sudo service mysqld restart

and for good measure

sudo service httpd restart

And let's test the MySQL installation, we'll start with command line. Type the following:

mysql -u root -p

this starts the mysql interface under the -u user and -p waits for password , you can type your mysql password in line, but it isn't very secure since it will be plain text on the screen. You should now have the mysql> prompt, type the following command:

show databases;

Note that I ran this after getting Booked installed and set up, you won't see the bookedscheduler database at this time, but yours should look something like this:

8

Page 9: Install Booked on CentOS

Exit out of mysql and type the following to check another aspect:

mysqladmin -u user -p status

Now let's try PHPmyadmin, so type it's address into the browser (127.0.0.1/phpmyadmin)and you should get a login page.

Enter the root user and password that you just created and you should be in.

9

Page 10: Install Booked on CentOS

Before we get to dealing with Booked, we have another very important command to run, this sets the permission for Apache to access the databases. Back in terminal type the following:

sudo setsebool -P httpd_can_network_connect_db 1

it will take some time to run and finishes without a message. We are finally ready to start dealing with Booked. First thing we need to do is edit the php.ini file and set the correct time zone. This file should be located in /etc/, but you can find it by opening the file manager and searching for it, then right click and check properties to find its location, mine was in /etc/ so I used the following to edit it in terminal:

sudo vi /etc/php.ini

10

Page 11: Install Booked on CentOS

Page down to the “Module Settings” section, uncomment the date.timezone (remove the “;”) and add your correct time zone to the document. Then save and quit.

Now we can deal with the Booked config file, go to the extracted folder and edit the timezone and insert an install password like the directions say you should do. It's covered pretty well in the included directions so I didn't get any screen captures.

11

Page 12: Install Booked on CentOS

We now need to copy the Booked files into the web server folders to be able to serve them up to users. Since we still need root, this means a trip back to the terminal:

cd ~/Downloads/booked

sudo cp -R * /var/www/html

This should only take a few seconds because the files are not big. Launch the File Browser and navigate to the /var/www/html folder and check to make sure everything is there.

12

Page 13: Install Booked on CentOS

Now we need to set permissions on those files, again back to terminal:

sudo chgrp apache /var/www/html -R

sudo chmod g+rwx /var/www/html -R

The -R stands for recursive and will tunnel down through all sub folders and files to assign the Apache group and read/write/exec for that group to all the files. This may be a bit heavy handled, the tpl and tpl_c folders need this level of privileges. Not sure if the other files really need this much. You can check to make sure things worked by going back to the File Browser and opening the tpl folder, right click on a file and see if it has read and write listed for the Apache group.

13

Page 14: Install Booked on CentOS

Time to give this a whirl, good idea to restart the httpd service. Then open a web browser and type into the address bar:

127.0.0.1/Web/install

Note the capital W on web or it will not reach the page. Enter your installer password that you typed into the Booked config file.

14

Page 15: Install Booked on CentOS

Now type in the database root account and root password, check the three boxes and hit the Run Installation button.

If it all worked, you should see something like this:

15

Page 16: Install Booked on CentOS

Now you need to test it. Go back to 127.0.0.1 in your browser and you should see the Booked log in page.

Type in the sample admin user name and sample admin password (password) and you should arrive at the Dashboard.

16

Page 17: Install Booked on CentOS

Editing the hosts file. Open up a terminal and type:

sudo vi /etc/hosts

at the bottom of the file add your server IP (tab) server FQDN (fully qualified domain name).

Save it with :w! And quit :q! . Now when you restart httpd or mysqld there should be no error about finding the address and should look pretty much like this:

Again, if you have a DNS server set up properly, you would have never seen the errors in the first place. A DNS server is really the better place to resolve this as it is easier to change things as a system evolves and IP addresses change.

17

Page 18: Install Booked on CentOS

That's it, you should now be ready to test Booked on a CentOS 6.x server. Some of the holes will need to be patched, the firewall will need to be opened, etc., but this gives the basic rundown of what you need to do to get Booked functional on a CentOS server. The reason I wrote this is because I spent considerable time trying to get this working. A quick question on the CentOS forums solved the last mystery about the setsebool command which allowed Apache to talk to the database. Before learning this I was stuck not being able to get Booked to connect to the DB, even if I went through the manual process of setting the DB up. Since PHP My Admin was able to connect, I thought there must be some other package missing that Booked needed. One simple command that I didn't find with web searches completely stopped me. Not sure if anyone else will run into this problem, but thought it was at least worth documenting so I would have it in my files for reference when I needed to set this up for real.

This guide written by Greg Endler, April 6, 2014. That should serve as enough of a statement of ownership, should probably be gpl or copyleft or something like that, I'll just have Nick file it with the rest of the documents for distribution. It was compiled from tips gathered from several sources, put into a somewhat cohesive form to do the specific task of getting Booked running so I can test some modifications to the code to make Booked do a couple things we need on our production system, and to prepare for the time when we can install our production system. I may revise this when I get more info about plugging security holes and making sure the webserver has all the configuration it needs. I'll try to make sure any revised versions end up with Nick.

Good luck, hope everything works for you.

18