{"id":899,"date":"2012-12-26T02:58:11","date_gmt":"2012-12-26T10:58:11","guid":{"rendered":"http:\/\/blog.portnumber53.com\/?p=899"},"modified":"2012-12-26T02:58:11","modified_gmt":"2012-12-26T10:58:11","slug":"raspberry-pi-installing-a-lamp-server","status":"publish","type":"post","link":"https:\/\/blog.portnumber53.com\/index.php\/2012\/12\/26\/raspberry-pi-installing-a-lamp-server\/","title":{"rendered":"Raspberry Pi: installing a LAMP server"},"content":{"rendered":"<p>Let&#39;s put the Raspberry Pi to good use:<\/p>\n<p>&nbsp;<\/p>\n<p>1. Install Mysql<\/p>\n<p>sudo pacman -S mysql<\/p>\n<p>2. Start your server<\/p>\n<p># systemctl start mysqld<\/p>\n<p>3. Secure your mysql installation<\/p>\n<p># \/usr\/bin\/mysql_secure_installation<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SERVERS IN PRODUCTION USE!&nbsp; PLEASE READ EACH STEP CAREFULLY!<\/p>\n<p>\n\tIn order to log into MySQL to secure it, we&#39;ll need the current<br \/>\n\tpassword for the root user.&nbsp; If you&#39;ve just installed MySQL, and<br \/>\n\tyou haven&#39;t set the root password yet, the password will be blank,<br \/>\n\tso you should just press enter here.<\/p>\n<p>\tEnter current password for root (enter for none):<br \/>\n\tOK, successfully used password, moving on&#8230;<\/p>\n<p>\tSetting the root password ensures that nobody can log into the MySQL<br \/>\n\troot user without the proper authorisation.<\/p>\n<p>\tSet root password? [Y\/n] y<br \/>\n\tNew password:<br \/>\n\tRe-enter new password:<br \/>\n\tPassword updated successfully!<br \/>\n\tReloading privilege tables..<br \/>\n\t&nbsp;&#8230; Success!<\/p>\n<p>\n\tBy default, a MySQL installation has an anonymous user, allowing anyone<br \/>\n\tto log into MySQL without having to have a user account created for<br \/>\n\tthem.&nbsp; This is intended only for testing, and to make the installation<br \/>\n\tgo a bit smoother.&nbsp; You should remove them before moving into a<br \/>\n\tproduction environment.<\/p>\n<p>\tRemove anonymous users? [Y\/n] y<br \/>\n\t&nbsp;&#8230; Success!<\/p>\n<p>\tNormally, root should only be allowed to connect from &#39;localhost&#39;.&nbsp; This<br \/>\n\tensures that someone cannot guess at the root password from the network.<\/p>\n<p>\tDisallow root login remotely? [Y\/n] y<br \/>\n\t&nbsp;&#8230; Success!<\/p>\n<p>\tBy default, MySQL comes with a database named &#39;test&#39; that anyone can<br \/>\n\taccess.&nbsp; This is also intended only for testing, and should be removed<br \/>\n\tbefore moving into a production environment.<\/p>\n<p>\tRemove test database and access to it? [Y\/n] y<br \/>\n\t&nbsp;&#8211; Dropping test database&#8230;<br \/>\n\t&nbsp;&#8230; Success!<br \/>\n\t&nbsp;&#8211; Removing privileges on test database&#8230;<br \/>\n\t&nbsp;&#8230; Success!<\/p>\n<p>\tReloading the privilege tables will ensure that all changes made so far<br \/>\n\twill take effect immediately.<\/p>\n<p>\tReload privilege tables now? [Y\/n] y<br \/>\n\t&nbsp;&#8230; Success!<\/p>\n<p>\tCleaning up&#8230;<\/p>\n<p>\tAll done!&nbsp; If you&#39;ve completed all of the above steps, your MySQL<br \/>\n\tinstallation should now be secure.<\/p>\n<p>\tThanks for using MySQL!<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>&nbsp;<\/p>\n<p># nano \/etc\/mysql\/my.cnf<\/p>\n<p>&nbsp;<\/p>\n<p>[mysqld]<\/p>\n<pre style=\"line-height: 125%\">bind-address=127.0.0.1<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Restart mysql<\/p>\n<p>systemctl restart mysqld<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>================<\/p>\n<p>Install PHP<\/p>\n<p>&nbsp;<\/p>\n<pre class=\"literal-block\">pacman -S php php-apache libmcrypt libtool<\/pre>\n<p>&nbsp;<\/p>\n<p>nano \/etc\/php\/php.ini<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>======================<\/p>\n<p>&nbsp;<\/p>\n<p>nano \/etc\/locale.gen<\/p>\n<p>enable:<\/p>\n<p>en_US.UTF-8 UTF-8<br \/>\n\ten_US ISO-8859-1<\/p>\n<p>&nbsp;<\/p>\n<p>save and generate your locales<\/p>\n<p># locale-gen<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Install and Configure PostgreSQL<\/p>\n<p>pacman -S postgresql<\/p>\n<p>&nbsp;<\/p>\n<p># mkdir -p \/var\/lib\/postgres\/data<\/p>\n<p># chown httpd:httpd -Rv \/var\/lib\/postgres\/<\/p>\n<p>&nbsp;<\/p>\n<p>Configure Postgresql data dir<\/p>\n<p># su &#8211; postgres -c &quot;initdb &#8211;locale en_US.UTF-8 -D &#39;\/var\/lib\/postgres\/data&#39;&quot;<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>The files belonging to this database system will be owned by user &quot;httpd&quot;.<br \/>\n\tThis user must also own the server process.<\/p>\n<p>\tThe database cluster will be initialized with locale &quot;en_US.UTF-8&quot;.<br \/>\n\tThe default database encoding has accordingly been set to &quot;UTF8&quot;.<br \/>\n\tThe default text search configuration will be set to &quot;english&quot;.<\/p>\n<p>\tfixing permissions on existing directory \/var\/lib\/postgres\/data &#8230; ok<br \/>\n\tcreating subdirectories &#8230; ok<br \/>\n\tselecting default max_connections &#8230; 100<br \/>\n\tselecting default shared_buffers &#8230; 24MB<br \/>\n\tcreating configuration files &#8230; ok<br \/>\n\tcreating template1 database in \/var\/lib\/postgres\/data\/base\/1 &#8230; ok<br \/>\n\tinitializing pg_authid &#8230; ok<br \/>\n\tinitializing dependencies &#8230; ok<br \/>\n\tcreating system views &#8230; ok<br \/>\n\tloading system objects&#39; descriptions &#8230; ok<br \/>\n\tcreating collations &#8230; ok<br \/>\n\tcreating conversions &#8230; ok<br \/>\n\tcreating dictionaries &#8230; ok<br \/>\n\tsetting privileges on built-in objects &#8230; ok<br \/>\n\tcreating information schema &#8230; ok<br \/>\n\tloading PL\/pgSQL server-side language &#8230; ok<br \/>\n\tvacuuming database template1 &#8230; ok<br \/>\n\tcopying template1 to template0 &#8230; ok<br \/>\n\tcopying template1 to postgres &#8230; ok<\/p>\n<p>\tWARNING: enabling &quot;trust&quot; authentication for local connections<br \/>\n\tYou can change this by editing pg_hba.conf or using the option -A, or<br \/>\n\t&#8211;auth-local and &#8211;auth-host, the next time you run initdb.<\/p>\n<p>\tSuccess. You can now start the database server using:<\/p>\n<p>\t&nbsp;&nbsp;&nbsp; postgres -D \/var\/lib\/postgres\/data<br \/>\n\tor<br \/>\n\t&nbsp;&nbsp;&nbsp; pg_ctl -D \/var\/lib\/postgres\/data -l logfile start<br \/>\n\t&nbsp;<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>&nbsp;<\/p>\n<p>Enable the service<\/p>\n<p># systemctl enable postgresql<\/p>\n<p>Start if you want to use it before rebooting<\/p>\n<p># systemctl start postgresql<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Let&#39;s put the Raspberry Pi to good use: &nbsp; 1. Install Mysql sudo pacman -S mysql 2. Start your server # systemctl start mysqld 3. Secure your mysql installation # \/usr\/bin\/mysql_secure_installation &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SERVERS IN PRODUCTION USE!&nbsp; PLEASE&#8230; <a class=\"continue-reading-link\" href=\"https:\/\/blog.portnumber53.com\/index.php\/2012\/12\/26\/raspberry-pi-installing-a-lamp-server\/\"> Continue reading <span class=\"meta-nav\">&rarr; <\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,11,14],"tags":[42,191,210,253,272,276,286,305],"class_list":["post-899","post","type-post","status-publish","format-standard","hentry","category-development","category-hosting","category-linux","tag-apache","tag-installation","tag-lamp","tag-mysql","tag-php","tag-postgresql","tag-raspberry-pi","tag-server"],"_links":{"self":[{"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/posts\/899","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/comments?post=899"}],"version-history":[{"count":0,"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/posts\/899\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/media?parent=899"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/categories?post=899"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/tags?post=899"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}