Lamp(Fpm-Php)基本配置-创新互联
LAMP简介
创新互联是一家以网络技术公司,为中小企业提供网站维护、成都网站设计、做网站、成都外贸网站建设公司、网站备案、服务器租用、域名注册、软件开发、成都小程序开发等企业互联网相关业务,是一家有着丰富的互联网运营推广经验的科技公司,有着多年的网站建站经验,致力于帮助中小企业在互联网让打出自已的品牌和口碑,让企业在互联网上打开一个面向全国乃至全球的业务窗口:建站欢迎咨询:028-86922220LAMP(Linux- Apache-MySQL-PHP)网站架构是目前国际流行的Web框架,该框架包括:Linux操作系统,Apache网络服务器,MySQL数据库,Perl、PHP或者Python编程语言,所有组成产品均是开源软件,是国际上成熟的架构框架,很多流行的商业应用都是采取这个架构。LAMP具有通用、跨平台、高性能、低价格的 优势,因此LAMP无论是性能、质量还是价格都是企业搭建网站的选平台。
二 Mysql 配置
1首先下载mysql-5.5.33包组(mariadb-5.5.36-linux-x86_64.tar.gz),然后解压mariadb-5.5.36-linux-x86_64.tar.gz到/usr/local
[root@localhost ~]# tar xfmariadb-5.5.36-linux-x86_64.tar.gz -C /usr/local
2准备数据存放的文件系统
a新建一个sda3
[root@localhost~]# fdisk /dev/sda
Command (m for help): n
Commandaction
e extended
p primary partition (1-4)
p
Partitionnumber (1-4): 3
Firstcylinder (7859-13054, default 7859):
Usingdefault value 7859
Lastcylinder, +cylinders or +size{K,M,G} (7859-13054, default 13054): +20G
Command(m for help): t
Partitionnumber (1-4): 3
Hex code(type L to list codes): 8e (文件系统为LVM)
Changedsystem type of partition 3 to 8e (Linux LVM)
Command (m for help): w
b读入磁盘中
[root@localhost ~]# kpartx -af /dev/sda
device-mapper: reload ioctl on sda1failed: Invalid argument
create/reload failed on sda1
device-mapper: reload ioctl on sda2failed: Invalid argument
create/reload failed on sda2
device-mapper: reload ioctl on sda3failed: Invalid argument
create/reload failed on sda3
[root@localhost ~]# partx -a /dev/sda
BLKPG: Device or resource busy
error adding partition 1
BLKPG: Device or resource busy
error adding partition 2
BLKPG: Device or resource busy
error adding partition 3 (表示已经读入到磁盘中)
c新建逻辑卷,并将其挂载至特定目录,此处目录设置为/mydata
[root@localhost ~]# pvcreate /dev/sda3
Physical volume "/dev/sda3" successfully created
[root@localhost ~]# vgcreate myvg/dev/sda3
Volume group "myvg" successfully created
[root@localhost ~]# lvcreate -L 10G -nmydata myvg
Logical volume "mydata" created
[root@localhost ~]# mke2fs -t ext4 -LMYDATA -b 4096 -m 3 /dev/myvg/mydata
并且能开机挂载,编辑fastab文件
/dev/mapper/vg0-root / ext4 defaults 1 1
UUID=90ebd4cf-95c1-4338-b0dd-19b2b1cb943d/boot ext4 defaults 1 2
/dev/mapper/vg0-usr /usr ext4 defaults 1 2
/dev/mapper/vg0-var /var ext4 defaults 1 2
/dev/mapper/vg0-swap swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
LABEL=MYDATA /mydata ext4 defaults 0 0
(开机挂载)
d 新建用户以安全方式运行进程,并创建链接
[root@localhost ~]# groupadd -r mysql
[root@localhost ~]# useradd-g mysql -r mysql
[root@localhost ~]# idmysql
uid=496(mysql)gid=493(mysql) groups=493(mysql)
[root@localhost ~]#chown -R mysql.mysql /mydata/data/
[root@localhost ~]# ll -a/mydata/data/
total 8
drwxr-xr-x 2 mysql mysql4096 Aug 11 20:15 .
先进入/usr/local目录下
[root@localhost local]# ln-sv mariadb-5.5.36-linux-x86_64 mysql
lrwxrwxrwx 1 root root 27 Aug 11 20:18mysql -> mariadb-5.5.36-linux-x86_64
e 为mysql提供主配置文件
cd/usr/local/mysql/
mkdir /etc/mysql创建一个目录,因为在/etc下有个my.cnf
cpsupport-files/my-large.cnf /etc/mysql/my.cnf
vim/etc/mysql/my.cnf
port = 3306
socket =/tmp/mysql.sock
skip-external-locking
key_buffer_size = 256M
max_allowed_packet = 1M
table_open_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size= 16M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8
datadir = /mydata/data (指定mysql数据文件的存放位置)
开始初始化
[root@localhostmysql]# scripts/mysql_install_db --user=mysql --datadir=/mydata/data/
(此处必须在 mysql目录下,要在scripts初始化,会报错)
f 为mysql提供sysv服务脚本
[root@localhostmysql]# cp support-files/mysql.server /etc/rc.d/init.d/mysqld
然后添加到服务列表中
[root@localhost mysql]# chkconfig --addmysqld
[root@localhost mysql]# chkconfig --list mysqld
mysqld 0:off1:off2:on3:on4:on5:on6:off
启动服务
root@localhost mysql]# service mysqld start
Starting MySQL... [ OK ]
[root@localhost mysql]# ss -tnl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:52971 *:*
LISTEN 0 128 :::50732 :::*
LISTEN 0 128 :::111 :::*
LISTEN 0 128 *:111 *:*
LISTEN 0 128 :::22 :::*
LISTEN 0 128 *:22 *:*
LISTEN 0 128 127.0.0.1:631 *:*
LISTEN 0 128 ::1:631 :::*
LISTEN 0 100 ::1:25 :::*
LISTEN 0 100 127.0.0.1:25 *:*
LISTEN 0 128 127.0.0.1:6010 *:*
LISTEN 0 128 ::1:6010 :::*
LISTEN 0 50 *:3306 *:* (3306端口已启动)
设置权限
[root@localhostmysql]#chmod +x /etc/rc.d/init.d/mysqld
g 编辑环境变量
[root@localhost~]# vim /etc/profile.d/mysql.sh
exportPATH=/usr/local/mysql/bin:$PATH
h导出头文件和库文件
ln -sv /usr/local/mysql/include /usr/include/mysql
[root@localhost~]# vim /etc/ld.so.conf.d/mysql.conf(新建)
/usr/local/mysql/lib
让系统重新载入
[root@localhost ~]#ldconfig -v | grep mysql
/usr/local/mysql/lib:
libmysqld.so.18 -> libmysqld.so.18
libmysqlclient.so.18 ->libmysqlclient_r.so.18.0.0
/usr/lib64/mysql:
libmysqlclient.so.16 -> libmysqlclient.so.16.0.0
libmysqlclient_r.so.16 -> libmysqlclient_r.so.16.0.0
三 Apache2.4.9 编译安装
首先检测pcre-devel "Development tools" "Server Platform Development" 这个三个包组装了没
yum -y
install
pcre-devel
yum -y groupinstall
"Development tools"
另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
网站标题:Lamp(Fpm-Php)基本配置-创新互联
标题网址:http://pwwzsj.com/article/ehjdc.html