{"id":7007,"date":"2020-05-05T08:28:57","date_gmt":"2020-05-05T06:28:57","guid":{"rendered":"https:\/\/michlstechblog.info\/blog\/?p=7007"},"modified":"2020-05-20T16:28:28","modified_gmt":"2020-05-20T14:28:28","slug":"linux-install-lamp-stack-on-debian-10-buster","status":"publish","type":"post","link":"https:\/\/michlstechblog.info\/blog\/linux-install-lamp-stack-on-debian-10-buster\/","title":{"rendered":"Linux: Install LAMP Stack on Debian 10 (Buster)"},"content":{"rendered":"<div class=\"twoclick_social_bookmarks_post_7007 social_share_privacy clearfix 1.6.4 locale-en_US sprite-en_US\"><\/div><div class=\"twoclick-js\"><script type=\"text\/javascript\">\/* <![CDATA[ *\/\njQuery(document).ready(function($){if($('.twoclick_social_bookmarks_post_7007')){$('.twoclick_social_bookmarks_post_7007').socialSharePrivacy({\"services\":{\"flattr\":{\"uid\":\"Michl\",\"status\":\"on\",\"the_title\":\"Linux%3A%20Install%20LAMP%20Stack%20on%20Debian%2010%20%28Buster%29\",\"the_excerpt\":\"Hi%20%2C%0D%0A%0D%0Athis%20post%20describes%20the%20steps%20to%20install%20a%20lamp%20stack%20on%20debian%20linux.%20This%20is%20the%20base%20for%20many%20content%20management%20systems%20like%20Joomla%2C%20Wordpress%20or%20Drupal.%0D%0A%20%28more%26hellip%3B%29\",\"txt_info\":\"2 clicks for more data protection:\\r\\n\\r\\nOnly when you click here, the button will be come active and you can send your recommendation to Flattr. When activating, data are transmitted to third parties. \",\"perma_option\":\"off\"}},\"txt_help\":\"When you activate these fields by clicking, information to Flattr may be transferred abroad, and probably may also stored there.\",\"settings_perma\":\"Enable permanently and accept data transmission. \",\"info_link\":\"http:\\\/\\\/www.heise.de\\\/ct\\\/artikel\\\/2-Klicks-fuer-mehr-Datenschutz-1333879.html\",\"uri\":\"https:\\\/\\\/michlstechblog.info\\\/blog\\\/linux-install-lamp-stack-on-debian-10-buster\\\/\",\"post_id\":7007,\"post_title_referrer_track\":\"Linux%3A+Install+LAMP+Stack+on+Debian+10+%28Buster%29\",\"display_infobox\":\"on\"});}});\n\/* ]]> *\/<\/script><\/div><p>Hi ,<\/p>\n<p>this post describes the steps to install a lamp stack on debian linux. This is the base for many content management systems like Joomla, WordPress or Drupal.<br \/>\n<!--more--><br \/>\nIn Debian 10 the LAMP stack consists of <strong>L<\/strong>inux, the <strong>A<\/strong>pache 2 Webserver, <strong>M<\/strong>ariaDB 10 and <strong>P<\/strong>HP 7.3.<\/p>\n<p>LAMP means linux as operating system, apache as webserver,  mysql as database and PHP as script language. To install all packages login as root.<br \/>\n<!--more--><br \/>\nRefresh package list from repositories<br \/>\n<code><br \/>\nroot@debdevt:~# apt-get update<br \/>\n<\/code><br \/>\nInstall apache 2<br \/>\n<code><br \/>\nroot@debdevt:~# apt-get -y install apache2<br \/>\n<\/code><br \/>\nThe config of the default site (http) is defined in file<br \/>\n<code>\/etc\/apache2\/sites-available\/000-default.conf<\/code><br \/>\nAdd a<br \/>\n<code><br \/>\nHostnameLookups Off<br \/>\n<\/code><br \/>\ndirective to do not resolve IP Addresses to hostnames in logfile.<br \/>\nNote: If wordpress permalinks returns 404 file not found errorpages add a<br \/>\n<code><br \/>\n&lt;Directory \/var\/www\/html&gt;<br \/>\nAllowOverride All<br \/>\n&lt;\/Directory&gt;<br \/>\n<\/code><br \/>\ndirective into the virtualhost section of \/etc\/apache2\/sites-available\/000-default.conf. Also check that module mod_rewrite is enabled.<br \/>\n<code>root@debdevt:~# a2query -m rewrite<br \/>\n<\/code><br \/>\nif not enable it<br \/>\n<code>root@debdevt:~# a2enmod rewrite<\/code><br \/>\nand check if the .htaccess file in the root directory of your wordpress installation is writeable for the user www-data.<br \/>\n<code>root@debdevt:\/var\/www\/html\/blog# ls -la \/var\/www\/html\/blog\/.htaccess<br \/>\n-rw-rw---- 1 www-data root 246 Feb 24 22:32 \/var\/www\/html\/blog\/.htaccess<br \/>\n<\/code><\/p>\n<p>respectively for https<br \/>\n<code>\/etc\/apache2\/sites-available\/default-ssl.conf<\/code><br \/>\n<strong>Note<\/strong>: https is disabled by default due to missing certificates. <a title=\"OpenSSL: Command line examples\" href=\"http:\/\/michlstechblog.info\/blog\/openssl-command-line-examples\/\">Here<\/a> you can find an how to generate a selfsigned certificate for an apache webserver.<\/p>\n<p>Start apache<br \/>\n<code>root@debdevt:~# systemctl start apache2<\/code><br \/>\nif the start on jessie fails check systemd log<br \/>\n<code>root@debdevt:~# journalctl -xn<\/code><\/p>\n<p>Install MariaDB. During the installation you will be prompted for the mysql root password. Choose a secure password and notice it in a secure location.<br \/>\n<code><br \/>\nroot@debdevt:~# apt-get -y install  mariadb-common mariadb-server<br \/>\n<\/code><br \/>\nSecure your MySQL database installation<br \/>\n<code><br \/>\nroot@debdevt:~# mysql_secure_installation<br \/>\nRemove anonymous users? [Y\/n] y<br \/>\n... Success!<br \/>\nDisallow root login remotely? [Y\/n] y<br \/>\n... Success!<br \/>\nRemove test database and access to it? [Y\/n] y<br \/>\n- Dropping test database...<br \/>\nReload privilege tables now? [Y\/n] y<br \/>\nCleaning up...<\/p>\n<p>All done!  If you've completed all of the above steps, your MariaDB<br \/>\ninstallation should now be secure.<\/p>\n<p>Thanks for using MariaDB!<br \/>\n<\/code><\/p>\n<p>Open MySQL Console<br \/>\n<code><br \/>\nroot@debdevt:~# mysql -u root -p<br \/>\n<\/code><br \/>\nCreate a database named cms and a user with full permission on the datebase with Username cmsuser and password cmspassword<br \/>\n<code><br \/>\nMariaDB&gt; create database cms;<br \/>\nMariaDB&gt; CREATE USER 'cmsuser'@'localhost' identified by 'cmspassword';<br \/>\nMariaDB&gt; grant all on cms.* to 'cmsuser'@'localhost';<br \/>\n<\/code><br \/>\nInstall php<br \/>\n<code><br \/>\nroot@debdevt:~# apt-get -y install php7.3 libapache2-mod-php7.3 php7.3-mysql php-pear<br \/>\n<\/code><br \/>\nCheck PHP. Create a php file in your webserver root<\/p>\n<pre><code>\r\ncat &gt; \/var\/www\/html\/phpinfo.php &lt;&lt;EOF\r\n&lt;?php\r\nphpinfo();\r\n?&gt;\r\nEOF\r\n<\/code><\/pre>\n<p>Time to check the LAMP stack. Open a browser and navigate to<br \/>\n<code>http:\/\/IPorHostnameOfyourLAMP\/phpinfo.php<\/code><br \/>\nthis should show a php status site.<\/p>\n<figure id=\"attachment_7014\" aria-describedby=\"caption-attachment-7014\" style=\"width: 300px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2020\/05\/php-state-7.3.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2020\/05\/php-state-7.3-300x276.png\" alt=\"php state 7.3\" width=\"300\" height=\"276\" class=\"size-medium wp-image-7014\" srcset=\"https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2020\/05\/php-state-7.3-300x276.png 300w, https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2020\/05\/php-state-7.3-768x707.png 768w, https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2020\/05\/php-state-7.3.png 939w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-7014\" class=\"wp-caption-text\">php state 7.3<\/figcaption><\/figure>\n<p>If phpinfo site is shown correctly delete the file<br \/>\n<code>root@debdevt:~# rm \/var\/www\/html\/phpinfo.php<\/code><\/p>\n<p>Not necessary but useful: Enable apache PHP logging for apache.<br \/>\nCreate a directory for logs<br \/>\n<code><br \/>\nroot@debdevt:~# mkdir \/var\/log\/php<br \/>\nroot@debdevt:~# chown www-data \/var\/log\/php<\/code><br \/>\nEdit <strong>\/etc\/php\/7.3\/apache2\/php.ini<\/strong> and set<\/p>\n<pre><code>error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR\r\ndisplay_errors = Off \r\nlog_errors = On \r\nerror_log = \/var\/log\/php\/error.log  <\/code><\/pre>\n<p>To import a database exported by myPhpAdmin for example. Open the sql file and alter the database name at the top of the file<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nCREATE DATABASE IF NOT EXISTS `DATABASE_AT_WEBHOSTER` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;\r\nUSE `DATABASE_AT_WEBHOSTER`;\r\n<\/pre>\n<p>to<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nCREATE DATABASE IF NOT EXISTS `cms` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;\r\nUSE `cms`;\r\n<\/pre>\n<p>and import the database<br \/>\n<code><br \/>\nroot@debdevt:~# mysql -u cmsuser -p &lt; exported_database.sql<br \/>\n<\/code><\/p>\n<p>That&#8217;s it.<\/p>\n<p>Michael<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi , this post describes the steps to install a lamp stack on debian linux. This is the base for many content management systems like Joomla, WordPress or Drupal.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[870,3,1438,37,291],"tags":[625,859,623,119,622,619,224,1439,620,624,621,862],"class_list":["post-7007","post","type-post","status-publish","format-standard","hentry","category-debian","category-linux","category-mariadb","category-mysql","category-wordpress","tag-625","tag-apache","tag-cms","tag-install","tag-joomla","tag-lamp","tag-linux-2","tag-mariadb","tag-mysql-2","tag-permalinks","tag-php","tag-wordpress"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/7007","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/comments?post=7007"}],"version-history":[{"count":11,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/7007\/revisions"}],"predecessor-version":[{"id":7045,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/7007\/revisions\/7045"}],"wp:attachment":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/media?parent=7007"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/categories?post=7007"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/tags?post=7007"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}