Raspberry 搭建 phpMyAdmin

更换源

由于树莓派自带的官方源速度太慢,这里需要更换国内源

sudo <span class="hljs-keyword">cp</span> /etc/apt/sources<span class="hljs-preprocessor">.list</span> /etc/apt/sources<span class="hljs-preprocessor">.list</span><span class="hljs-preprocessor">.bak</span>  <span class="hljs-preprocessor">#备份为 sources.list.bak</span>
sudo nano /etc/apt/sources<span class="hljs-preprocessor">.list</span>     <span class="hljs-preprocessor">#编辑sources.list  文件</span>

进入编辑页面,把原有的修改为

deb http://mirrors<span class="hljs-preprocessor">.ustc</span><span class="hljs-preprocessor">.edu</span><span class="hljs-preprocessor">.cn</span>/raspbian/raspbian/ wheezy main non-free contrib
deb-src http://mirrors<span class="hljs-preprocessor">.ustc</span><span class="hljs-preprocessor">.edu</span><span class="hljs-preprocessor">.cn</span>/raspbian/raspbian/ wheezy main non-free contrib

更换完之后,执行更新源操作

<span class="hljs-built_in">sudo</span> apt-get update

安装LAMP

执行安装的代码

sudo apt-get install apache2 MySQL-<span class="hljs-keyword">server</span> mysql-<span class="hljs-keyword">client</span> php5 php5-gd php5-mysql <span class="hljs-preprocessor">#安装LAMP环境</span>

安装的过程中会弹出来一个输入框两次,是让输入mysql密码,默认的用户名为root
安装完毕后,网页存放路径为/var/www/html目录下,放入index.php文件测试一下是否可以
接下来安装phpmyadmin

安装phpMyAdmin

<span class="hljs-built_in">sudo</span> apt-get install phpmyadmin <span class="hljs-comment">#安装phpmyadmin</span>

安装过程中弹出选择框
第一次的弹框有apache和lightd两个选项,按空格选中Apache2,回车
第二次选择No,除非你会手动配置phpmyadmin的一些设置

启用 apahce 的 mod_rewrite 模块

<span class="hljs-built_in">sudo</span> a2enmod rewrite

再把phpmyadmin链接到/var/www/html目录下

<span class="hljs-built_in">sudo</span> ln <span class="hljs-operator">-s</span> /usr/share/phpmyadmin /var/www/html

最后重启Apache,测试是否可以

提醒

最后设置一下目录权限

sudo chown root:root /<span class="hljs-built_in">var</span>/www<span class="hljs-subst">/</span> <span class="hljs-attribute">-R</span>
sudo find /<span class="hljs-built_in">var</span>/www<span class="hljs-subst">/</span> <span class="hljs-attribute">-type</span> d <span class="hljs-attribute">-exec</span> chmod <span class="hljs-number">755</span> {} <span class="hljs-subst">\</span>;
sudo find /<span class="hljs-built_in">var</span>/www<span class="hljs-subst">/</span> <span class="hljs-attribute">-type</span> f <span class="hljs-attribute">-exec</span> chmod <span class="hljs-number">644</span> {} <span class="hljs-subst">\</span>;

《Raspberry 搭建 phpMyAdmin》有一个想法

评论已关闭。