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/.envb: 文件.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
安装PCREsudo 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
安装zlibtar -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
安装openssltar -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
安装nginxtar -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-devwget 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…
OKTo start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your systemPLEASE 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_installationwhich 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.plPlease 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环境,该安装过程许多地方还有问题,记录下这些主要是为以后学习参考用。安装过程中出现的许多其它问题,这里都没有记录,遇到问题的处理方式,主要是根据错误提示,分析问题原因。