您的位置:首页 > 运维架构 > Apache

搭建LAMP(Linux + Apache + Mysql + PHP/Perl/Python)站点

2013-04-29 10:17 921 查看
(1) 先安装MySQL
perl-DBI-1.52-1.fc6.i386.rpm
mysql-5.0.45-7.el5.i386.rpm
perl-DBD-MySQL-3.0007-1.fc6.i386.rpm
mysql-server-5.0.45-7.el5.i386.rpm

(2) 安装PHP
php-common-5.1.6-20.el5.i386.rpm
php-cli-5.1.6-20.el5.i386.rpm
php-5.1.6-20.el5.i386.rpm
php-pdo-5.1.6-20.el5.i386.rpm
php-mysql-5.1.6-20.el5.i386.rpm

配置php,让它支持老版本的php,需要修改/etc/httpd/conf.d/php.conf :
AddType text/html .php .php3 <=添加 .php3

(3) 建一个基于IP地址的虚拟主机:
n 虚拟主机的站点主目录为:/tmp/bblog;
n 从共享文件ftp服务器ftp://172.16.100.250/RPM/httpd 中下载bBlog站点文件bBlog-0.7.6.tar.gz到用户主目录中,
n 再解压bBlog网站素材到这个虚拟主机的站点主目录;
n 重新启动Apahce服务器;
n 在虚拟主机的站点主目录/tmp/bblog下新建一个php测试文件mytest.php,文件内容为:
<? phpinfo( ) ; ?>

在浏览器中输入 http://你的IP地址/mytest.php
如果有出现如下显示php的版本信息的页面就表示php安装成功。

(4) 配置bBlog的MySQL数据库及数据库用户;
数据库名字:bblog;
可以登录这个数据库的用户:bblogadmin;
(数据库名和数据库用户在第5步:bBlog安装中需要使用)

//先启动MySQL服务守护进程;
[root@linux ~]# service mysqld start

//建立数据库和用户,给这个用户赋予访问数据库的所有权限
[root@linux ~]# mysql

//建立名为bblog的数据;

mysql> create database bblog; <==注意每个指令后面都要加上分号 (;)
Query OK, 1 row affected (0.01 sec)

//建立用户bblogadmin,并赋予用户bblogadmin对数据库bblog中所有表所有权限,bblogadmin用户登录密码为:1qaz2wsx

mysql> grant all privileges on bblog.* to bblogadmin@localhost
identified by '1qaz2wsx' ;
Query OK, 0 rows affected (0.00 sec)

mysql> show databases;
+----------+
| Database |
+----------+
| bblog | <==看到了吗?多了一个数据库
| mysql | <==主要用来记录MySQL的账号、主机等重要信息的主要数据库
| test |
+----------+
3 rows in set (0.00 sec)

//推出mysql
mysql> exit

//以用户 bblogadmin 登录mysql;
[root@linux ~]# mysql –u bblogadmin –p
Password:1qaz2wsx

mysql>connect bblog //测试用户bblogadmin连接到数据库bblog
OK! //有OK表示成功;

mysql>show tables; //查看bblog数据库中的表,应该为空;

mysql> exit //退出mysql



(5)安装bBlog站点: http://你的IP地址/bblog/install.php 按步骤安装;
bBlog need to be able to write to disk to store it's cache of templates, and if you want to use the blo.gs favorites functionality.
We will now check the permissions of the 'cache' folder, the 'compiled_templates' folder, and the 'cache/favorites.xml' file. They all need to be writable by the webserver. This will involve chmodding the folders and files with your ftp client ( if you're not using ftp you probally know what do do here ). Permissions should either be 775. If that doesn't work, 777 will.
Additionally, ./config.php should be writable during the install. At the end of the install when the config file is written to disk, you should change the permissions back so it is not writable by the webserver.
./cache is NOT writable

./compiled_templates is NOT writable

./cache/favorites.xml is NOT writable

./config.php is NOT writable

改变上述文件权限为可写:

配置数据库:

安装完成:还需要删除站点目录下的安装目录 bblog/install,并把站点主目录下的bblog/config.php文件的可写权限去掉;

显示你的个人blog: http://你的IP地址/
管理你的个人blog,加新日志等; http://你的IP地址/bblog
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: