将StartOS5.1打造成PHP开发者环境 LAMP

昨天中午的时候下载了5.1版,在win7中使用sbin撞倒D盘给分配了10G空间,感觉很爽。。。 以后就一直作为开发环境使用了。。。 从昨天装完之后到现在一直在这个系统上。。 希望官方赶紧把 x64正式版发布
 
-------- 早知道有这个系统就好了,我被ubuntu折腾了一年多,见我的帖子:  http://vb2005xu.iteye.com/blog/1748575
期间我也用过了arch,但是很多东西需要配置,没有startos 这么给力。安装之后基本就不用管
 
我的机器是如下配置, http://item.jd.com/861728.html 1700多的笔记本,蛮不错的
 
安装很方便,我用其作为开发环境,所以装完之后装了些开发工具。
 
但是源里面的sublime text2是过期的,建议从官方下载,file /bin/ls 用这个来检测系统是 32/64位的系统
软件中心的 rapadSVN | phpStorm 慢好用的,远程登陆需要自己安装 ssh 工具包,基本ok啦
 
1. 安装gcc
Linux 发行版一般不会集成编译环境。在 StartOS 下,可以运行:sudo yget --install build-essential 来安装基本的编译环境,包含 gcc,make,patch 和常用的头文件;如果需要安装某个软件的编译环境,以 vim 为例:sudo yget --install-dev vim
 
如果安装失败,先执行下 sudo yget --update
 
2. phpstrom注册码

username:EMBRACE

license:

===== LICENSE BEGIN =====
43136-12042010
00002UsvSON704l"dILe1PVx3y4"B3
49AU6oSDJrsjE8nMOQh"8HTDJHIUUh
gd1BebYc5U"6OxDbVsALB4Eb10PW8"
===== LICENSE END =====

 

JetBrain WebStorm 注册码

webStorm : 

UserName:William 
===== LICENSE BEGIN ===== 
45550-12042010 
00001SzFN0n1bPII7FnAxnt0DDOPJA 
INauvJkeVJBuE5bqLEznccE4tet6tr 
RiyoMxDK8oDY93tx!ipPyGmqYYeWxS 
===== LICENSE END ===== 
UserName:Microsoft 
===== LICENSE BEGIN ===== 
44827-12042010 
00001xZTATXBeJGHI0CFFRIdOKjhQ7 
eiwIjgK7qohmwGSZRUK!lINYbpNQKk 
5AtC16jzcy6KWlkBBjTZXwL8fnebTM 
===== LICENSE END ===== 
UserName:ChinaRed 
===== LICENSE BEGIN ===== 
41806-12042010 
000006gMpIpRoMPJdqqPfxIYyr5UPx 
fTuYnZxklVYrNOZUHL6YnHTAUM4zqe 
qNrt8QzsZERfO"XiHa802ejK9GtcSj 
===== LICENSE END ===== 

rubyMine : 
UserName:William 
===== LICENSE BEGIN ===== 
73770-12042010 
00000LsPnluU7HZh4TgJoxNDbnCr!T 
0yDfranplDJF4ESFHxfhN6dMBEogxt 
S!qZH7LvIjab"9qbXrSfL9NitEBODm 
===== LICENSE END ===== 
UserName:Microsoft 
===== LICENSE BEGIN ===== 
05071-12042010 
00001DGDB7Ih6YT6ApG0Uh4wxMwJqf 
UjDDJvi5mX0yJS!72q8ZrLhKQfusV" 
NVSB9iV!lO1tRbt265"z0vZJBwpl!9 
===== LICENSE END ===== 
UserName:ChinaRed 
===== LICENSE BEGIN ===== 
26405-12042010 
00001cYtAkKGNyQA7Er6A9e4oS2Y"I 
fK"d"APYe591kwLAHVZ7ieFmfoTKTS 
90BTaTdrTg36JEivKlxfVaDszIkWuM 
===== LICENSE END ===== 

phpStorm : 
UserName:William 
===== LICENSE BEGIN ===== 
56731-12042010 
00001F"L73xP5zfOyL58"Vg0hu"R8S 
!aPyCtkqgqc5fEvdQLlLs5a9gzvAcu 
!2Gb!gp9kfKoAp1e81dVuhM"a8OJ4v 
===== LICENSE END ===== 
UserName:Microsoft 
===== LICENSE BEGIN ===== 
06656-12042010 
00002NFsdQw64GSoAeS1!oxQRM!H8k 
Rh3soGkXar1UJa27G0Gx3uz4FEq6Fb 
CW09ado0neq"3gqd3lZ8KnE303G"MP 
===== LICENSE END ===== 
UserName:ChinaRed 
===== LICENSE BEGIN ===== 
83865-12042010 
00001jJvs5lu13QqsSxk1XXwwpiGL1 
4GGM"RKB0xBaYtK6Uh4NVG26"TBhTA 
HNKvcsV38NwMho1Wdy75KY61SwSdVQ 
===== LICENSE END ===== 

pyCharm : 
UserName:William 
===== LICENSE BEGIN ===== 
43064-12042010 
00002qm1!PHwV!dC19Cvu04E6IXZJ9 
GN"RaF03!bwPE"x3RZbg7ctJld7yZl 
XkVf40g3JJGG4Ibbbg4"HQPwWJWSFU 
===== LICENSE END ===== 
UserName:Microsoft 
===== LICENSE BEGIN ===== 
77380-12042010 
000017q0LbsOLEIcYF3VRZszWAYE"K 
CYfpWmqrUTJy"ROE03pXMWLZ6Z9jbh 
cccsmd3P32vdo!L4tnEkp1jrOuySvx 
===== LICENSE END ===== 
UserName:ChinaRed 
===== LICENSE BEGIN ===== 
42852-12042010 
00000zw1KaqXWsbN7MiExhdvN!PIjf 
ZDCOi0vxBEGX9QDUYIyvr0768OloCU 
FUZ4Evyh4lNEFKRDEVnKye9W2DYxPp 
===== LICENSE END =====

 

3. 12306 购票访问

一、打开https://dynamic.12306.cn/otsweb/
二、点“仍然继续”
三、重新打开12306就可以了

 

4. 安装 apache + php + mysql

安装步骤按 http://vb2005xu.iteye.com/blog/1682189 来进行吧

下载的是 httpd-2.2.25,把它装在自己的目录中吧

./configure --prefix=/home/kenxu/dist/apache2 --disable-status --disable-userdir --disable-threads --disable-ipv6 --enable-modules='ssl so rewrite deflate headers expires'

使用 上文1 安装的编译环境会爆出 apr 和 apr-devel apr-utils没有安装,在软件中心搜索安装即可

deflate 这个扩展 会爆出

checking whether to enable mod_deflate... configure: error: mod_deflate has been requested but can not be built due to prerequisite failures

这是因为 没有安装zlib包,安装zlib-devel

接着会爆出:

configure: error: ...No recognized SSL/TLS toolkit detected

这是因为 没有安装openssl包,安装openssl-devel

此时配置成功,make 时出错:

libtool: link: cannot find the library `/usr/lib/libexpat.la' or unhandled argument `/usr/lib/libexpat.la'

这是因为 没有安装expat库,安装expat-dev

make clean 之后再次运行 make

libtool: link: cannot find the library `/usr/lib/libuuid.la' or unhandled argument `/usr/lib/libuuid.la'

找了N久都没找到相应的信息,最后想起在centos中这个包好像是在libuuid is part of the util-linux-ng package since version 2.15.1,安装 util-linux-ng-dev ,再次 make 就通过了

make install 成功安装

 

mysql 就直接从软件中心里面安装了,安装之后配置下就行

安装万之后,配置文件在/etc/mysql/my.cnf,在里面新增参数:

skip-name-resolve
innodb_buffer_pool_size=768M
innodb_flush_log_at_trx_commit=2

然后运行 mysqld_safe & 即可

 

PHP是下载的 php-5.3.27 版本

类似apache编译方式,采取静态编译的方式来编译扩展,并禁用无需的模块:

./configure --prefix=/home/kenxu/dist/php --with-apxs2=/home/kenxu/dist/apache2/bin/apxs --with-config-file-path=/home/kenxu/dist/php/php-config --with-png-dir --with-jpeg-dir --with-gd --with-curl --with-zlib --enable-mbstring --with-mcrypt --with-freetype-dir=/usr --with-mysql=/usr/bin/mysql --with-mysqli --enable-pdo --with-pdo-mysql=/usr/bin/mysql --without-pdo-sqlite --with-openssl

 爆出:

configure: error: Please reinstall the libcurl distribution - easy.h should be in <curl-dir>/include/curl/

安装 curl-dev 包后解决

接着会报 libpng-dev , libjpeg-dev,gd-dev,freetype-dev 未找到,全部装上

再次运行会爆出:

configure: error: Sorry, I was not able to diagnose which libmcrypt version you have installed.

找到 libmcrypt 将 libmcrypt,libmcrypt-dev都装上

再次运行会爆出:

configure: error: Cannot find MySQL header files under /usr/bin/mysql

仔细检查发现,原来mysql安装的时候头文件在 /usr/include/mysql下所以此处指定/usr就行

./configure --prefix=/home/kenxu/dist/php --with-apxs2=/home/kenxu/dist/apache2/bin/apxs --with-config-file-path=/home/kenxu/dist/php/php-config --with-png-dir --with-jpeg-dir --with-gd --with-curl --with-zlib --enable-mbstring --with-mcrypt --with-freetype-dir=/usr --with-mysql=/usr --with-mysqli --enable-pdo --with-pdo-mysql=/usr --without-pdo-sqlite --with-openssl

此时配置成功,make爆出

致命错误:libxml/parser.h:没有那个文件或目录

安装 libxml2-dev 包之后解决,再次运行爆出 libidn没找到,安装libidn-dev继续编译,libssh2-dev也要安装

openldap-dev,cyrus-sasl-dev,gnutls-dev,libtasn1-dev,libgpg-error-dev也要安装

再次make通过了,make test 下试试,跑完10634个测试,安装即可

 

为PHP安装 eAccelerator 插件 

从 eAccelerator.net 下载最新的稳定版本,编译时启用共享内存:
解压缩后进入源码目录,运行 ~/dist/php/bin/phpize 生成配置文件,然后执行

export PHP_PREFIX="/home/kenxu/dist/php"
$PHP_PREFIX/bin/phpize

./configure --enable-shared --with-php-config=$PHP_PREFIX/bin/php-config

参见:https://github.com/eaccelerator/eaccelerator/wiki/InstallFromSource

注意 eAccelerator 当前不支持php5.5

 

环境至此配置成功,运行apache吧

启动bin/apachectl start的时候:

发现报错:httpd: bad user name daemon

解决方法:

groupadd daemon

useradd -g daemon daemon

再运行 apachectl start 就成功啦

打开浏览器输入 http://localhost/phpinfo.php 可以看到访问成功。

给 apache 配置虚拟主机,因为在开发时使用自定义域名更给力,故开启httpd.conf这行

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

一切设置完成后,在浏览器中运行host出现在You don't have permission to access / on this server.  提示。查了一下apache手册找到问题所在处。这里定义了默认对网站根的访问权限。

找到  httpd-vhosts.conf 文件,将其中内容进行如下修改:

 


<VirtualHost *:80>
ServerName localhost
ServerAdmin [email protected]
DocumentRoot /home/kenxu/dist/apache2/htdocs
ErrorLog logs/localhost-error.txt 
</VirtualHost>


<Directory "/home/kenxu/appcode/sfcan">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory> 

<VirtualHost *:80>
ServerName sfcan.io
DocumentRoot /home/kenxu/appcode/sfcan
ErrorLog logs/sfcan.io-error.txt 
</VirtualHost>

然后再次访问,就ok了

sudo leafpad /etc/hosts 在里面新增 127.0.0.1 sfcan.io 然后访问 sfcan.io 就能访问了

至此,整个环境就配置成功了,为了管理Mysql,可以下载一个phpmyadmin程序放到

/home/kenxu/dist/apache2/htdocs 下然后访问 http://localhost/phpmyadmin 就ok啦

由于安装的mysql未设置管理员密码,所以使用phpmyadmin访问不了,所以设置它的管理员密码:

mysqladmin -u root password "newpwd"

如果忘记mysql的root密码可以采取下面的步骤重新设置:

kill掉所有mysql的进程

使用--skip-grant-tables的参数启动mysql

mysqld_safe --skip-grant-tables &

设置新的密码,同样两种方式可以选择

方法一

shell> mysqladmin -u root flush-privileges password "newpwd"

方法二

mysql> UPDATE mysql.user SET Password=PASSWORD('newpwd')

-> WHERE User='root';

mysql> FLUSH PRIVILEGES;

停止mysql server,用正常的模式启动

 

 

猜你喜欢

转载自vb2005xu.iteye.com/blog/1958438
今日推荐