Installing Apache2 On Raspberry Pi

72 Comments

Raspberry Pi Project 3 LAMPi, a Raspberry Pi based LAMP server. Introduction
LAMPi The Raspberry Pi LAMP Server Project now also has its own website LAMPi. Due to the horrible weather last weekend I found more time to play with my Raspberry Pi Ive got an ArduinoXBee based Wireless Sensor Network with associated storagereporting back end and ever since I put it together for a MSc coursework Ive been planning to swap out the Mini ITX LAMP server for a Ras. Pi. In the long run Im hoping to also add one of the XBee Series 2 modules to the Ras. Pi so it can also take on the role of my current XBee to Ethernet concentrator hence the Slice of pi boards in step 1. The following is a quick walkthrough of the necessary steps for setting up your own LAMPi and at the end a little section on how to readwrite SD card images, details on my first attempts to do a bit of load testing on the LAMPi with JMeter and further thoughtslinksaccessory ramblings. Step by Step instructions on how to install Cacti on Raspberry Pi running Raspian Wheezy or any other Linux distro Be up and running in 30 minutes Raspberry PI Web Cam. The Raspberry PI is perfectly equipped to turn your USB based web cam into a fully functional IP web cam that you can have lots of fun with. If you dont want to set all this up yourself feel free to download my image. It includes everything from Step 1 7 and was created as per Step 8. In case you run the JMeter plan from Step 9 against one of these Id be grateful if you could let me have results and details on your SD card. Step 1 Preparation Since there is still a certain amount of will my XYZ work with a Ras. Pi Im going to start by listing what my Ras. Pi is currently connected to. If in doubt buy kit which is mentioned on the official verified peripherals list. Installing Apache2 On Raspberry Pi' title='Installing Apache2 On Raspberry Pi' />Installing Apache2 On Raspberry PiIve hooked up my prospective LAMP Pi to Samsung Sync. Master 2. 26. BW with a Belkin HDMI lead and HDMI to DVI adapter. Cherry wired optical USB mouse, Cherry GENTTIX Model No JM 0. Cherry wired USB UK layout keyboard, Model No JK 0. Apple AC to USB adapter and a no name micro USB lead. CAT6 cable to a Netgear 8port gigabit desktop switch. Integral 2. GB mini SD card with matching adapter. Original Debian Squeeze image. If you are running the Squeeze image for the first time Your user name is pi. Your password is raspberry raspberry is also the password for everything else Ive installed belowOnce you are logged in start LXDE your desktop with startx. To get screenshots install scrot and run scrot Y m dswxhscrot. Installing Apache2 On Raspberry Pi' title='Installing Apache2 On Raspberry Pi' />This Raspberry Pi MYSQL PHPMyAdmin tutorial is an extension to the webserver tutorial that I did earlier. You dont need to have done that tutorial to be able to. I had the same issue while importing PIL and further importing the ImageTk and Image modules. I also tried installing PIL directly through pip. This tutorial will take you through the steps to install Apache2 and PHP 7 on a Raspberry Pi for a cheap, super quick web server. Before we begin installing Nconf, Well need to go login to PHPmyadmin and create the required Nconf database and user Browse to httpNagiosPiphpmyadmin. Introduction LAMPi The Raspberry Pi LAMP Server Project now also has its own website www. LAMPi. co. uk. Due to the horrible weather last weekend I found more. Vous voulez hberger un site web sur votre Raspberry Pi mais vous ne savez pas comment faire Raspbian France vous apprend installer un serveur Apache. DesktopIf youre running headless you can reboot via ssh with sudo reboot or shutdown with sudo shutdown h nowIf you dont like the Midori get Chromium with sudo apt get install chromium browser and dont forget to run sudo chown pi pi. Most of the below will need root privileges. Start you terminal session with sudo su or add sudo in front of the commands. Step 2 SSH ssh keygen t rsa mv bootbootenablessh. Im doing this from OSX so I use ssh usernameyourip in a Terminal window. Installing Apache2 On Raspberry Pi' title='Installing Apache2 On Raspberry Pi' />I think on windows you would like to use Pu. TTY but thats not my world Step 3 Lets install Apache 2 groupadd www datausermod a G www data www dataapt get updateapt get install apache. To test point a remote web browser at http your LAMP Pi ip. As usual your websites files will live in varwww. Step 4 Lets install PHP5 apt get install php. To test put a file called phpinfo. This is what you want inside your file lt You might also want to install some of these, they all worked on my LAMP Pi apt get install libapache. To test point a remote web browser at at http your LAMP Pi ipphpinfo. Step 5 Lets install My. SQL apt get install mysql server mysql client php. To test run mysql uroot ppassword and replace password with whatever you picked when you installed My. SQL but leave the p in front of it which should get you a My. SQL prompt exit gets you out of that one. Step 6 Lets install php. My. Admin apt get install libapache. And add the extension to your Apache php. To test point a remote web browser at http your LAMP Pi ipphpmyadmin. Step 7  Lets install Tight. VNCServer Optional And for all those situations where your LAMP Pi is running headless but you still wantneed a full LXDE desktop Ive installed Tight. VNCServer. apt get install xorg lxde core tightvncserver. To start it run tightvncserver 1. And to kill the above session run tightvncserver kill 1. I use Chicken Of the VNC and all I have to do is enter the LAMP Pi IP into the host box, 1 into the Display box, put in my password and click connect. Step 8 Lets install creating and writing SD card images under OSX This one isnt for the faint hearted as it uses dd. If you dont know what dd is or think it means disk destroyer better get yourself a Windows based machine and use Win. Disk. Imager http www. CD DVD ToolsData CD DVD BurningWin. Disk Imager. shtml. If youre on Ubuntu Id recommend a nice graphical tool called Image. Writer Ive got Ubuntu on a Sony laptop next to me just for the task of writing images, its my fastest SD card readerwriter. Step 8 creating and writing SD card images under OSX This one isnt for the faint hearted as it uses dd. If you dont know what dd is or think it means disk destroyer better get yourself a Windows based machine and use Win. Disk. Imager http www. CD DVD ToolsData CD DVD BurningWin. Disk Imager. shtml. Who Is On My Wifi Keygen Pc on this page. If youre on Ubuntu Id recommend a nice graphical tool called Image. Writer Ive got Ubuntu on a Sony laptop next to me just for the task of writing images, its my fastest SD card readerwriter. Im doing this on OSX 1. OSX versions. 8. 1 To create an image from a SC Card Insert SD Card my i. Mac has a slot at the side underneath its optical driveWait until your card gets mounted on the desktop and make a note of its name. Open Terminal and run mount. Youll get a list of all your mounted devices and one of the lines should relate to your SD Card. Mine was called NO NAME and I get this back from mount devdisk. VolumesNO NAME msdos, local, nodev, nosuid, noownersTake the devXYZ line and strip it back to just the device without the partition. In this case thats devdisk. The following dd command then creates a image called lampi. The resulting image will be the size of your SD card but therell be a lot of empty space in your image so it should compress well gzip lampi. To write back an image to a SC Card Insert your target SD card and wait until it gets mounted to the desktop. Unmount the SD card with diskutil unmount disk. To write the image to the SD card with dd run sudo dd iflampi. Step 9 LAMP Pi load testing with JMeter Ive only done a very basic test against phpinfo. It should serve very well for smallmid sized LAMP projects and with basic html content Apache. The same test runs with very much the same results in regards to speed from both an ancient 2. GB Mini SD card and a fast 8. GB San. Disk Ultra 1. MBs, 4 but I will try again once I get my new faster SD cards. Performance of the My. SQL database will obviously be limited due to it running off the same SD card as the whole underlying system but it will still work well as a storage backend. Im going to write a JMeter test plan for the My. SQL side later today and swap the board in as the storagereporting back end for my ArduinoXBee WSN to get an idea how it perfoms under real life conditions. This is my test JMeter Test plan. All you need to do to use it is to change the IP under HTTP Request Defaults. LAMPiJMeter. Step 1. Raspberry Pi MYSQL PHPMy. Admin Tutorial This Raspberry Pi MYSQL PHPMy. Admin tutorial is an extension to the webserver tutorial that I did earlier. You dont need to have done that tutorial to be able to complete this one. If youre unfamiliar of MYSQL this is a great way to get learning it. My. SQL is a relational database management system and allows you store maintain data. It is one of the worlds most popular relational database system and is commonly included in most LAMP stacks. For anyone who doesnt know Php. My. Admin is a free tool that has been designed to allow for easy administration of MYSQL. It is hugely popular and used in a lot of web server environments throughout the world. If you want to see how this is all done visually be sure to check out the video, I have put together below. It will take you through from start to finish on how to get this done. As always if you like the video then please subscribe to my channel Equipment. Below is the equipment that you will need in order to complete this Raspberry Pi MYSQL tutorial. Recommended Raspberry Pi. GB SD Card or Micro SD Card if youre using a Raspberry Pi 2, 3 or BEthernet Cord or Wifi dongle. Optional USB Keyboard USB Mouse Getting Started. As always you will need to have Raspbian installed or a similar operating system installed before we can get started. Be sure to head over to my page on installing Raspbian if you havent yet learnt how to do this. I have broken this tutorial down into two steps, first we will install the web server software and also MYSQL. In the 2nd step we will take a look at installing the PHPMy. Admin. If you have come from the Raspberry Pi web server tutorial, then you can simply skip the first step as you would have already done this. Installing Raspberry Pi MYSQL1. Firstly lets install the mysql server onto the Raspberry Pi. You will be prompted to enter a password for the root user. Make sure you write this down as we will need to use this to access the MYSQL server and connect PHPMy. Admin to it. 3. If youre not prompted to enter a password you will need to enter the following command. Answer all the questions so it will be setup to match your security requirements. Now if you want to access and start make changes to the database simply enter the following command sudo mysql u root p. It will now prompt you to enter the password we just created. You can now enter MYSQL commands to create, alter, delete databases. Youre able to leave the MYSQL command line by simply entering quit. If you want to be able to interact with MYSQL in Python you will need to install the Python bindings as well. You can do this by entering the following command. Now were done installing the Raspberry Pi MYSQL you may want to install PHPMy. Admin so you have a nice clean interface to work with. Creating a MYSQL Database User. By default PHPMy. Admin will disallow you to login using the root login. Instead you will need to create a new user if you wish to create and access datatables within PHPMy. Admin. To do this first login as root with the password you selected. Now run the following command, replcing username with the username of your choice. Also replace password with a secure password of your choice. GRANT ALL PRIVILEGES ON mydb. Burda Style Magazine. TO usernamelocalhost IDENTIFIED BY password 3. You can exit by entering quit. Once done you can proceed to installing PHPMy. Admin. Installing Raspberry Pi PHPMy. Admin. You will find that installing Raspberry Pi PHPMy. Admin is very easy to do any wont take long at all. If you havent already installed a web server you can learn from our guide on installing Apache or our guide on installing NGINX. I will go on the assumption you have already setup your own web server and setup PHP for it. Please note that these steps will differ a bit if you are using Apache or NGINX. Now lets install the PHPMy. Admin package, you can do this by entering the following command on your Raspberry Pi. It will now begin to install. You will be presented with a screen asking the type of web server you want it to run off. Select apache. 2 even if you are using NGINX since this doesnt hugely matter for us. Next we will need to configure PHPMy. Admin to connect to our SQL database server. The one we set up previously in installing the Raspberry Pi MYSQL step or the web server. To do this select yes at the next prompt. The setup tool will now ask for a password, enter the one you set for root when setting up your SQL Server, this is needed for php. My. Admin to talk with the SQL Server and manage your databases. Next it will ask you to set a password for PHPMy. Admin itself. It is best to set this password to something different to your root SQL password. Make sure you remember it as this is the password you will need to access the interface. With that done we can now proceed to configure our web servers for use with php. My. Admin. These steps differ for both Apache and NGINX so make sure you follow the correct list of steps. Configuring Apache for php. My. Admin. 7a. To begin setting up Apache for use with php. My. Admin enter the following command into terminal sudo nano etcapache. Now at the bottom of this file enter the following line Include etcphpmyadminapache. Once done save exit by pressing CTRL X and then y. Now simply restart the Apache service by entering the following command sudo etcinit. Configuring NGINX for php. My. Admin. 7a. To setup NGINX to work with php. My. Admin all we need to do is simply create a link between the phpmyadmin folder and our root html directory. To do this we simply need to run the following command sudo ln s usrsharephpmyadmin varwwwhtml. Now you should be able to access the PHPMy. Admin from a browser. To test go to the following address in your browser. Replace the IP with your IP. If you dont have it run the command hostname I on your Pihttp 1. If its all working, then youre good to go. You will need to login using a user other than root as this is disabled for security purposes. Further up in this tutorial I show you how to quickly make a database user. Assuming youre looking to learn how to setup Word. Press on the Raspberry Pi, then you can find that in my web server tutorial linked towards the top of this page. If you want to enable external access to the either PHPMy. Admin or MYSQL then you will need to setup port forwarding. To learn how to do this check out my guide on port forwarding. The ports you will need to forward is 8. PHPMy. Admin and MYSQL is 3. You will also need to make sure you have enabled outside access to SQL. If you want to learn more about MYSQL and the commands, you can use to view edit data then I recommend heading over to w. They have some great beginner tutorials to help bring you up to speed on using MYSQL. I hope you are able to get both the Raspberry Pi MYSQL PHPMy. Admin working from this tutorial. If you do come across something or feel that I have missed some important steps, then please feel free to drop a comment below. Please check your inbox for a confirmation email.