ubuntu11.10系统及nginx + php + mysql + netbeans开发环境安装笔记

ubuntu11.10设置的一些问题
1、终端 vi 编辑器中方向键不能使用,全部变成大写字母
原因:ubuntu中安装的vi是vi-tiny 功能不全,运行
sudo apt-get install vim
安装完整的vim即可解决此问题

另,在安装过程中可能出现 vim-common 相关的错误,导致无法安装vim,此是,用以下命令,先卸载掉vim-common,再安装vim 即可
sudo apt-get remove vim-common
sudo apt-get install vim

2、状态栏输入法图标不显示的问题
重启一下ibus即可
killall ibus-daemon
ibus-daemon -d

jdk7安装
下载jdk http://www.oracle.com/technetwork/java/javase/downloads/jdk-7u3-download-1501626.html
解压jdk 到 /usr/lib/jvm 如果没有jvm目录,需要自已建立
tar -xzvf jdk-7u3-linux-i586.tar.gz -C /usr/lib/jvm

修改环境变量

vi /etc/environment

增加
PATH=”/usr/lib/jvm/jdk1.7.0_03/bin”
CLASSPATH=”/usr/lib/jvm/jdk1.7.0_03/lib”
JAVA_HOME=”/usr/lib/jvm/jdk1.7.0_03″

补充知识:

环境变量设置文件相关
a: 环境变量相关文件
/etc/profile 是所有用户的环境变量
  /etc/enviroment是系统的环境变量

登陆系统时shell读取的顺序应该是
  /etc/profile ->/etc/enviroment –>$HOME/.profile –>$HOME/.env

b: 文件.profle 和 /ect/profile区别

1):用户家目录下的 .profle 和 /ect/profile 是登录运行的,并且运行一次。只是针对的用户不同而已。
/ect/profile 针对所有用户有效
.profle 针对当前用户有效

2):用户家目录下的 .bashrc 和 /ect/bash.bashrc (ubuntu下是这个) 是每次运行shell执行的。只是针对的用户不同而已。

3):共同点
都是可以配置环境变量的文件

4):不同点
在bashrc文件里定义变量不用 export (打开shell一次执行一次)
在profile文件里定义变量要用 export (因为只执行一次)

配置默认JDK版本
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_03/bin/java 300
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7.0_03/bin/javac 300
sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.7.0_03/bin/jar 300

检查
sudo update-alternatives --config java

查看java版本号
java -version

netbeans安装
下载netbeans http://netbeans.org/downloads/index.html
http://download.netbeans.org/netbeans/7.1.1/final/bundles/netbeans-7.1.1-ml-php-linux.sh

cd #下载目录
sudo chmod 777 netbeans-7.1.1-ml-php-linux.sh
sudo ./netbeans-7.1.1-ml-php-linux.sh

会启动自动安装界面,按提示安装即可

nginx安装
nginx需要安装 openssl、pcre、zlib
安装PCRE用来支持rewrite
下载
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.30.tar.bz2 #PCRE
wget http://www.openssl.org/source/openssl-1.0.1.tar.gz #openssl
wget http://downloads.sourceforge.net/project/libpng/zlib/1.2.3/zlib-1.2.3.tar.gz?use_mirror=cdnetworks-kr-1 #zlib
wget http://nginx.org/download/nginx-1.0.14.tar.gz #nginx

安装PCRE
sudo apt-get install g++ #首先保证安装了g++
tar -xjvf pcre-8.30.tar.bz2
cd pcre-8.30/
sudo ./configure --prefix=/usr/local/prce-8.30
sudo make
sudo make install

安装zlib
tar -xzvf zlib-1.2.3.tar.gz
cd zlib-1.2.3/
sudo ./configure --prefix=/usr/local/zlib-1.2.3
sudo make
sudo make install

安装openssl
tar -xzvf openssl-1.0.1.tar.gz
cd openssl-1.0.1/
sudo ./config --prefix=/usr/local/openssl-1.0.1
sudo make
sudo make install

安装nginx
tar -xzvf nginx-1.0.14.tar.gz
cd nginx-1.0.14/
sudo ./configure --prefix=/usr/local/nginx-1.0.14 --with-http_ssl_module --with-pcre=../pcre-8.30 --with-zlib=../zlib-1.2.3 --with-openssl=../openssl-1.0.1
sudo make
sudo make install

设置nginx开机自启动.
nginx本身没有启动脚本,使用网上找到的nginx-init-ubuntu脚本来启动。
项目地址:https://github.com/JasonGiedymin/nginx-init-ubuntu
wget https://raw.github.com/JasonGiedymin/nginx-init-ubuntu/master/nginx
注意配置项目,以下三项需要修改为自己机器相对应的目录
DAEMON=/usr/local/sbin/nginx # 修改为 /usr/local/nginx-1.0.14/sbin/nginx
PIDSPATH=/var/run #由于编译 nginx 时只指定了–prefix,所以本人机器上的PIDPATH路径默认为 /usr/local/nginx-1.0.14/logs
NGINX_CONF_FILE=”/usr/local/nginx/conf/nginx.conf” #本次安装配置文件路径为 /usr/local/nginx-1.0.14/conf/nginx.conf

要实现开机启动,需要将下载来的nginx-init-ubuntu文件放到 /etc/init.d/目录下,并且需要有执行权限。
本次安装做法如下:
nginx-init-ubuntu文件改名为nginx放在 /usr/local/ngix-1.0.14目录下,
然后创建软链接到 /etc/init.d/目录下

sudo mv nginx-init-ubuntu /usr/local/nginx-1.0.14
sudo ln -s /usr/local/nginx/nginx /etc/init.d/nginx
update-rc.d -f nginx defaults

这样就实现了开机自启动。并可以使用
/etc/init.d/nginx [start|stop|restart|force-reload|status|configtest|quietupgrade|terminate|destroy]
这些命令来设置nginx了.

安装mysql
安装libncurses5-dev
wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.9.tar.gz
tar -xzvf ncurses-5.9.tar.gz
cd ncurses-5.9.tar.gz
sudo ./configure --without-debug --with-shared
sudo make
sudo make install

安装Bison,需要先安装m4

wget http://ftp.gnu.org/gnu/m4/m4-1.4.16.tar.bz2
wget http://ftp.gnu.org/gnu/bison/bison-2.5.tar.gz
tar -xjvf m4-1.4.16.tar.bz2
cd m4-1.4.16/
sudo ./configure
sudo make
sudo make install
tar -xzvf bison-2.5.tar.gz
cd bison-2.5/
sudo ./configure
sudo make
sudo make install

下载mysql源码及cmake:
wget http://mysql.cs.pu.edu.tw/Downloads/MySQL-5.5/mysql-5.5.22.tar.gz
wget http://www.cmake.org/files/v2.8/cmake-2.8.7.tar.gz

安装cmake:
tar -xzvf cmake-2.8.7.tar.gz
cd cmake-2.8.7/
sudo ./bootstrap
sudo make
sudo make install

安装mysql:
sudo groupadd mysql #添加用户组
sudo useradd -r -g mysql mysql #添加用户
tar -xzvf mysql-5.5.22.tar.gz
#如果之前编译或者配置过,先清除之前的配置及编译信息
make clean
rm CMakeCache.txt
#编译
cmake -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
sudo make
sudo make install
#设置权限,安装系统数据表
cd /usr/local/mysql
chown -R mysql .
chgrp -R mysql .
sudo scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/
chown -R root .
chown -R mysql data
#启动服务
cp support-files/my-medium.cnf /etc/my.cnf
bin/mysqld_safe --user=mysql &
#添加开机启动
cp support-files/mysql.server /etc/init.d/mysql.server

运行 sudo scripts/mysql_install_db –user=mysql –basedir=/usr/local/mysql/ 成功后提示

Installing MySQL system tables…
OK
Filling help tables…
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/local/mysql//bin/mysqladmin -u root password ‘new-password’
/usr/local/mysql//bin/mysqladmin -u root -h sandy-VirtualBox password ‘new-password’

Alternatively you can run:
/usr/local/mysql//bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr/local/mysql/ ; /usr/local/mysql//bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/local/mysql//mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/local/mysql//scripts/mysqlbug script!

安装php
首先安装php依赖库 curl freetype libjpeg libpng DG2 libxml2 libxslt openldap
需要许多依赖库,根据安装时的提示,进行安装。

wget http://curl.haxx.se/download/curl-7.25.0.tar.gz
wget http://download.savannah.gnu.org/releases/freetype/freetype-2.4.9.tar.gz
wget http://www.ijg.org/files/jpegsrc.v8d.tar.gz
wget ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng-1.5.10.tar.gz
wget wget https://bitbucket.org/pierrejoye/gd-libgd/get/GD_2_0_33.tar.bz2
wget ftp://xmlsoft.org/libxml2/libxslt-git-snapshot.tar.gz

wget https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_12_6_RTM/src/nss-3.12.6-with-nspr-4.8.4.tar.gz
wget ftp://ftp.dti.ad.jp/pub/net/OpenLDAP/openldap-release/openldap-2.4.30.tgz

sudo apt-get install slapd ldap-utils libldap2-dev libsasl2-dev

./configure –prefix=/usr/local/php –with-mysql=/usr/local/mysql –with-mysqli=/usr/local/mysql/bin/mysql_config –with-pdo-mysql=/usr/local/mysql –with-iconv-dir=/usr/local –with-freetype-dir –with-jpeg-dir –with-png-dir=/usr –with-zlib –with-libxml-dir=/usr –with-curl –with-curlwrappers –with-mcrypt –with-gd –with-openss=/usr/local/oopenssl-1.0.1 –with-mhash –with-xmlrpc –enable-zip –enable-soap –disable-rpath –enable-discard-path –enable-safe-mode –enable-bcmath –enable-shmop –enable-sysvsem –enable-inline-optimization –enable-mbregex –enable-fastcgi –enable-fpm –enable-force-cgi-redirect –enable-mbstring –enable-gd-native-ttf –enable-pcntl –enable-sockets –enable-xml

如果出现提示:
error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory

可以去/usr/local/mysql/lib下面复制文件到/usr/lib下面,或者直接设置软链接。。。
再make clean,重新编译安装即可。
如果不行 设置 export LD_LIBRARY_PATH=”/usr/local/mysq/lib:$LD_LIBRARY_PATH”
再编译

后记:第一次编译安装lnmp环境,该安装过程许多地方还有问题,记录下这些主要是为以后学习参考用。安装过程中出现的许多其它问题,这里都没有记录,遇到问题的处理方式,主要是根据错误提示,分析问题原因。

转载于:https://www.cnblogs.com/jansonterry/p/5359225.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值