{"id":18786,"date":"2015-03-06T06:40:51","date_gmt":"2015-03-05T22:40:51","guid":{"rendered":"https:\/\/2blog.ilc.edu.tw\/25793\/2015\/03\/06\/banana-pi-%e6%b8%ac%e8%a9%a6-gentoo-linux-%e5%ae%89%e8%a3%9d-lamp-server\/"},"modified":"2021-03-18T17:24:20","modified_gmt":"2021-03-18T09:24:20","slug":"banana-pi-%e6%b8%ac%e8%a9%a6-gentoo-linux-%e5%ae%89%e8%a3%9d-lamp-server","status":"publish","type":"post","link":"https:\/\/2blog.ilc.edu.tw\/25793\/2015\/03\/06\/banana-pi-%e6%b8%ac%e8%a9%a6-gentoo-linux-%e5%ae%89%e8%a3%9d-lamp-server\/","title":{"rendered":"Banana Pi \u6e2c\u8a66 &#8211; Gentoo Linux \u5b89\u88dd LAMP Server"},"content":{"rendered":"<p>\u53c3\u8003\u7db2\u9801\uff1a <br \/><a href=\"http:\/\/www.tecmint.com\/install-lamp-in-gentoo-linux\/\" target=\"_blank\" rel=\"noopener noreferrer\">Installing LAMP (Linux, Apache, MySQL, PHP and PhpMyAdmin) in Gentoo Linux<\/a> <br \/><a href=\"http:\/\/blog.svnlabs.com\/installing-apache-mysql-php-in-gentoo-server\/#.VKQJY8mngdk\" target=\"_blank\" rel=\"noopener noreferrer\">Installing Apache, MySQL, PHP in Gentoo Server | S V N Labs Softwares<\/a> <br \/><a href=\"https:\/\/www.linode.com\/docs\/websites\/lamp\/lamp-server-on-gentoo\" target=\"_blank\" rel=\"noopener noreferrer\">LAMP Server on Gentoo &#8211; Linode Guides &amp; Tutorials<\/a> <\/p>\n<p>\u540c\u6b65\u5957\u4ef6\u5eab <br \/># <span style=\"color: #ff0000\">emerge &#8211;sync<\/span> <\/p>\n<p>\u66f4\u65b0\u6574\u500b\u7cfb\u7d71 <br \/># <span style=\"color: #ff0000\">emerge &#8211;update world<\/span> <\/p>\n<p>\u5b89\u88dd Apache Web Server <br \/># <span style=\"color: #ff0000\">emerge apache<\/span>[@more@]\u9810\u8a2d\u7db2\u9801\u6839\u76ee\u9304 <span style=\"color: #0000ff\">\/var\/www\/localhost\/htdocs\/<\/span> <br \/>\u5e95\u4e0b\u66f4\u6539\u6210 <span style=\"color: #0000ff\">\/var\/www\/html<\/span> <br \/># <span style=\"color: #ff0000\">cp \/etc\/apache2\/vhosts.d\/default_vhost.include \/etc\/apache2\/vhosts.d\/default_vhost.include.$(date +%F)<\/span> <br \/># <span style=\"color: #ff0000\">sed -i &#8216;s|\/var\/www\/localhost\/htdocs|\/var\/www\/html|&#8217; \/etc\/apache2\/vhosts.d\/default_vhost.include<\/span> <br \/># <span style=\"color: #ff0000\">mv \/var\/www\/localhost\/htdocs \/var\/www\/html<\/span> <\/p>\n<p>cgi \u76ee\u9304\u7531 <span style=\"color: #0000ff\">\/var\/www\/localhost\/cgi-bin<\/span> \u6539\u6210 <span style=\"color: #0000ff\">\/var\/www\/cgi-bin<\/span> <br \/># <span style=\"color: #ff0000\">sed -i &#8216;s|\/var\/www\/localhost\/cgi-bin|\/var\/www\/cgi-bin|&#8217; \/etc\/apache2\/vhosts.d\/default_vhost.include<\/span> <br \/># <span style=\"color: #ff0000\">sed -i &#8216;s|\/var\/www\/localhost\/cgi-bin|\/var\/www\/cgi-bin|&#8217; \/etc\/apache2\/vhosts.d\/00_default_ssl_vhost.conf<\/span> <\/p>\n<p>\u53d6\u6d88 Indexes \u76ee\u9304\u986f\u793a <br \/># <span style=\"color: #ff0000\">sed -i &#8216;s\/Options Indexes\/Options -Indexes\/&#8217; \/etc\/apache2\/vhosts.d\/default_vhost.include<br \/><\/span> <br \/>\u5c07\u4f7f\u7528\u8005\u7db2\u9801\u76ee\u9304\u7531 <span style=\"color: #0000ff\">public_html<\/span> \u6539\u6210 <span style=\"color: #ff0000\">www<\/span> <br \/># <span style=\"color: #ff0000\">sed -i &#8216;s\/public_html\/www\/&#8217; \/etc\/apache2\/modules.d\/00_mod_userdir.conf<\/span> <\/p>\n<p>\u589e\u52a0\u7db2\u9801\u76ee\u9304\u4e2d\u7684 index \u8a2d\u5b9a <br \/># <span style=\"color: #ff0000\">sed -i &#8216;s\/DirectoryIndex index.html index.html.var\/DirectoryIndex index.php index.html index.htm index.html.var\/&#8217; \/etc\/apache2\/modules.d\/00_default_settings.conf<\/span> <\/p>\n<p>\u53d6\u6d88 <span style=\"color: #0000ff\">Deny from all <\/span>\u8a2d\u5b9a <br \/># <span style=\"color: #ff0000\">vim \/etc\/apache2\/modules.d\/00_default_settings.conf<\/span> <br \/><span style=\"color: #0000ff\">&lt;Directory \/&gt;<\/span> <br \/><span style=\"color: #0000ff\"> Options FollowSymLinks<\/span> <br \/><span style=\"color: #0000ff\"> AllowOverride None<\/span> <br \/><span style=\"color: #0000ff\"> Order deny,allow<\/span> <br \/><span style=\"color: #ff0000\"># Deny from all<\/span> <br \/><span style=\"color: #0000ff\">&lt;\/Directory&gt;<\/span> <\/p>\n<p>\u5c07 <span style=\"color: #0000ff\">ServerSignature On<\/span> \u6539\u6210 <span style=\"color: #ff0000\">ServerSignature Off<\/span> <br \/># <span style=\"color: #ff0000\">sed -i &#8216;s\/ServerSignature On\/ServerSignature Off\/&#8217; \/etc\/apache2\/modules.d\/00_default_settings.conf<\/span> <\/p>\n<p>\u555f\u52d5 Apache Web Server\uff0c\u5982\u679c\u51fa\u73fe\u4e0b\u9762\u7684\u8a0a\u606f <br \/># <span style=\"color: #ff0000\">\/etc\/init.d\/apache2 start<\/span> <br \/><span style=\"color: #0000ff\"> * Starting apache2 &#8230;<\/span> <br \/><span style=\"color: #ff0000\">apache2: apr_sockaddr_info_get() failed for lemaker<\/span> <br \/><span style=\"color: #0000ff\"> * start-stop-daemon: failed to start `\/usr\/sbin\/apache2&#8242; [ !! ]<\/span> <br \/><span style=\"color: #0000ff\"> * ERROR: apache2 failed to start<\/span> <\/p>\n<p>\u8acb\u5728 <span style=\"color: #0000ff\">\/etc\/hosts<\/span> \u52a0\u5165\u4e00\u884c <br \/># <span style=\"color: #ff0000\">vim \/etc\/hosts<\/span> <br \/><span style=\"color: #0000ff\">127.0.0.1 lemaker<\/span> <\/p>\n<p>\u8a2d\u5b9a\u958b\u6a5f\u6642\u555f\u52d5 Apache Web Servr<br \/># <span style=\"color: #ff0000\">rc-update add apache2 default<\/span> <\/p>\n<p>\u5b89\u88dd MySQL Server<br \/># <span style=\"color: #ff0000\">emerge dev-db\/mysql<\/span> <\/p>\n<p>\u555f\u52d5 MySQL Server<br \/># <span style=\"color: #ff0000\">\/etc\/init.d\/mysql start<\/span> <br \/><span style=\"color: #0000ff\">\u00a0 * Checking mysqld configuration for mysql &#8230;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 [ ok ]<\/span><br \/><span style=\"color: #0000ff\">\u00a0* Starting mysql &#8230;<\/span><br \/><span style=\"color: #0000ff\">\u00a0* You don&#8217;t appear to have the mysql database installed yet.<\/span><br \/><span style=\"color: #ff0000\">\u00a0* Please run `emerge &#8211;config =dev-db\/mysql-5.5.40` to have this done&#8230;<\/span><br \/><span style=\"color: #0000ff\">\u00a0* ERROR: mysql failed to start<\/span><\/p>\n<p>\u5982\u679c\u51fa\u4e0a\u9762\u7684\u932f\u8aa4\u8a0a\u606f<br \/># <span style=\"color: #ff0000\">emerge &#8211;config =dev-db\/mysql-5.5.40<\/span><\/p>\n<p><span style=\"color: #0000ff\">Configuring pkg&#8230;<\/span><\/p>\n<p><span style=\"color: #0000ff\">\u00a0* Please provide a password for the mysql &#8216;root&#8217; user now, in the<\/span><br \/><span style=\"color: #0000ff\">\u00a0* MYSQL_ROOT_PASSWORD env var or through the \/root\/.my.cnf file.<\/span><br \/><span style=\"color: #0000ff\">\u00a0* Avoid [&#8220;&#8216;_%] characters in the password<\/span><br \/><span style=\"color: #0000ff\">\u00a0\u00a0\u00a0 &gt;<span style=\"color: #ff0000\">(\u8f38\u5165\u60a8\u8981\u8a2d\u5b9a\u7684 MySQL Server\u00a0\u5bc6\u78bc)<\/span><\/span><br \/><span style=\"color: #0000ff\">\u00a0* Retype the password<\/span><br \/><span style=\"color: #0000ff\">\u00a0\u00a0\u00a0 &gt;<\/span><span style=\"color: #ff0000\">(\u518d\u6b21\u8f38\u5165\u60a8\u8981\u8a2d\u5b9a\u7684 MySQL Server\u00a0\u5bc6\u78bc)<\/span><br \/><span style=\"color: #0000ff\">\u00a0* Creating the mysql database and setting proper<\/span><br \/><span style=\"color: #0000ff\">\u00a0* permissions on it &#8230;<\/span><br \/><span style=\"color: #0000ff\">\u00a0* Command: &#8216;\/usr\/share\/mysql\/scripts\/mysql_install_db&#8217; &#8216;&#8211;basedir=\/usr&#8217;\u00a0 &#8211;loose-skip-grant-tables &#8211;loose-skip-host-cache &#8211;loose-skip-name-resolve &#8211;loose-skip-networking &#8211;loose-skip-slave-start &#8211;loose-skip-ssl &#8211;loose-skip-log-bin &#8211;loose-skip-relay-log &#8211;loose-skip-slow-query-log &#8211;loose-skip-external-locking &#8211;loose-skip-log-slave-updates &#8211;user=mysql &#8211;loose-skip-innodb &#8216;&#8211;datadir=\/\/\/var\/lib\/mysql&#8217; &#8216;&#8211;tmpdir=\/\/\/tmp\/&#8217;<\/span><br \/><span style=\"color: #0000ff\">\u00a0* Starting mysqld &#8230;<\/span><br \/><span style=\"color: #0000ff\">\u00a0* Command \/\/usr\/sbin\/mysqld\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;loose-skip-grant-tables &#8211;loose-skip-host-cache &#8211;loose-skip-name-resolve &#8211;loose-skip-networking &#8211;loose-skip-slave-start &#8211;loose-skip-ssl &#8211;loose-skip-log-bin &#8211;loose-skip-relay-log &#8211;loose-skip-slow-query-log &#8211;loose-skip-external-locking &#8211;loose-skip-log-slave-updates &#8211;user=mysql &#8211;loose-skip-innodb\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;user=mysql\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;log-warnings=0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;basedir=\/\/usr\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;datadir=\/\/\/var\/lib\/mysql\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;max_allowed_packet=8M\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;net_buffer_length=16K\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;default-storage-engine=MyISAM\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;socket=\/\/var\/run\/mysqld\/mysqld16101.sock\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;pid-file=\/\/var\/run\/mysqld\/mysqld20041.pid<\/span><br \/><span style=\"color: #0000ff\">\u00a0*\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;tmpdir=\/\/\/tmp\/\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 [ ok ]<\/span><br \/><span style=\"color: #0000ff\">\u00a0* Setting root password &#8230;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 [ ok ]<\/span><br \/><span style=\"color: #0000ff\">\u00a0* Loading &#8220;zoneinfo&#8221;, this step may require a few seconds &#8230; &#8230;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 [ ok ]<\/span><br \/><span style=\"color: #0000ff\">\u00a0* Stopping the server &#8230;<\/span><br \/><span style=\"color: #0000ff\">\u00a0* Done<\/span><\/p>\n<p>MySQL Server\u00a0\u7684\u4e00\u4e9b\u5b89\u5168\u6027\u8a2d\u5b9a<br \/># <span style=\"color: #ff0000\">\/usr\/bin\/mysql_secure_installation<\/span><\/p>\n<p>\u8a2d\u5b9a\u958b\u6a5f\u6642\u555f\u52d5 MySQL Server<br \/># <span style=\"color: #ff0000\">rc-update add mysql default<\/span> <\/p>\n<p> MySQL Server \u8a2d\u5b9a\u6a94<br \/><span style=\"color: #0000ff\">\/etc\/mysql\/my.cnf<\/span><\/p>\n<p>\u5b89\u88dd PHP <br \/># <span style=\"color: #ff0000\">USE=&#8221;apache2 mysql mysqli php cli cgi pam ssl xml xml2 berkdb innodb jpeg png pcre session unicode&#8221; emerge &#8216;dev-lang\/php&#8217;<\/span><\/p>\n<p># <span style=\"color: #ff0000\">vim \/etc\/conf.d\/apache2<\/span> <br \/><span style=\"color: #0000ff\">APACHE2_OPTS=&#8221;-D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D LANGUAGE -D PHP5&#8243;<\/span> <\/p>\n<p>PHP\u00a0\u8a2d\u5b9a\u6a94<br \/><span style=\"color: #0000ff\">\/etc\/php\/apache2-php5.5\/php.ini<\/span><\/p>\n<p>PHP\u00a0\u4e00\u4e9b\u8a2d\u5b9a<br \/># <span style=\"color: #ff0000\">sed -i &#8216;s\/allow_url_fopen = On\/allow_url_fopen = Off\/&#8217; \/etc\/php\/apache2-php5.5\/php.ini<\/span><br \/># <span style=\"color: #ff0000\">sed -i &#8216;s\/expose_php = On\/expose_php = Off\/&#8217; \/etc\/php\/apache2-php5.5\/php.ini<\/span><br \/># <span style=\"color: #ff0000\">sed -i &#8216;s\/upload_max_filesize = 2M\/upload_max_filesize = 500M\/&#8217; \/etc\/php\/apache2-php5.5\/php.ini<\/span><br \/># <span style=\"color: #ff0000\">sed -i &#8216;s\/post_max_size = 8M\/post_max_size = 500M\/&#8217; \/etc\/php\/apache2-php5.5\/php.ini<\/span><br \/># <span style=\"color: #ff0000\">sed -i &#8216;s\/session.cookie_httponly =\/session.cookie_httponly = 1\/&#8217; \/etc\/php\/apache2-php5.5\/php.ini<\/span><br \/># <span style=\"color: #ff0000\">sed -i &#8216;s\/;date.timezone =\/date.timezone = Asia\/Taipei\/&#8217; \/etc\/php\/apache2-php5.5\/php.ini<\/span><br \/># <span style=\"color: #ff0000\">sed -i &#8216;s\/max_execution_time = 30\/max_execution_time = 300\/&#8217; \/etc\/php\/apache2-php5.5\/php.ini<\/span><br \/># <span style=\"color: #ff0000\">sed -i &#8216;s\/max_input_time = 60\/max_input_time = 600\/&#8217; \/etc\/php\/apache2-php5.5\/php.ini<\/span><\/p>\n<p>\u91cd\u65b0\u555f\u52d5 apache Web Server<br \/># <span style=\"color: #ff0000\">\/etc\/init.d\/apache2 restart<\/span> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u53c3\u8003\u7db2\u9801\uff1a Installing LAMP (Linux, Apache, MySQL, PHP and Ph &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/2blog.ilc.edu.tw\/25793\/2015\/03\/06\/banana-pi-%e6%b8%ac%e8%a9%a6-gentoo-linux-%e5%ae%89%e8%a3%9d-lamp-server\/\" class=\"more-link\">\u95b1\u8b80\u5168\u6587<span class=\"screen-reader-text\">\u3008Banana Pi \u6e2c\u8a66 &#8211; Gentoo Linux \u5b89\u88dd LAMP Server\u3009<\/span><\/a><\/p>\n","protected":false},"author":55,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[162,180],"tags":[],"class_list":["post-18786","post","type-post","status-publish","format-standard","hentry","category-c-83744","category-c-88041"],"meta_key":{"_pingme":["1"],"_encloseme":["1"],"lt_post_id":["553013"]},"_links":{"self":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts\/18786"}],"collection":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/users\/55"}],"replies":[{"embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/comments?post=18786"}],"version-history":[{"count":1,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts\/18786\/revisions"}],"predecessor-version":[{"id":20387,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts\/18786\/revisions\/20387"}],"wp:attachment":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/media?parent=18786"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/categories?post=18786"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/tags?post=18786"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}