一、首先安装JDK1.7 步骤1、解压tar包在当前目录 [root@localhost usr]# tar -xzvf jdk-7u25-linux-x64.tar.gz 步骤2:配置环境变量 在etc/profile文件下添加 export JAVA_HOME=/usr/java/jdk1.7.0_25 export CLASSPATH=/usr/java/jdk1.7.0_25/lib export PATH=$JAVA_HOME/bin:$PATH 添加环境变量后使用如下命令: [root@localhost ~]# source /etc/profile 使配置文件立即生效,在 验证环境变量是否生效 [root@localhost ~]# echo $JAVA_HOME /usr/java/jdk1.7.0_25 [root@localhost ~]# echo $PATH /usr/java/jdk1.7.0_25/bin:/usr/kerberos/sbin:/usr/kerberos/bin :/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin [root@localhost ~]# echo echo $CLASSPATH /usr/java/jdk1.7.0_25/lib 步骤3:使用java -version命令验证是否安装成功 [root@localhost tmp]# java -version java version "1.7.0_25" Java(TM) SE Runtime Environment (build 1.7.0_25-b15) Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode) 能看到以上信息表示已经安装成功 二、安装tomcat7 其实tomcat不用安装的,直接下载tomcat的tar包,使用tar -xvzf tomcat7.xx.tar.gz解压后,直接把java项目war文件上传到tomcat的webapps目录下,然后进入tomcat目录下的bin目录使用启动tomcat的命令:./startup.sh 就这么简单。 三、安装mysql 1、首先安装 cmake [root@localhost /]# yum install cmake [root@localhost ~]# /usr/sbin/groupadd mysql [root@localhost ~]#/usr/sbin/useradd -g mysql mysql [root@localhost ~]# tar xvf mysql-5.5.16.tar.gz [root@localhost ~]# cd mysql-5.5.16/
[root@localhost ~]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_MEMORY_STORAGE_ENGINE=1 \ -DWITH_READLINE=1 \ -DENABLED_LOCAL_INFILE=1 \ -DMYSQL_DATADIR=/var/mysql/data \ -DMYSQL_USER=mysql 如果在执行这一步时,报以下错误 -- MySQL 5.5.16 -- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH) CMake Error at cmake/readline.cmake:83 (MESSAGE): Curses library not found. Please install appropriate package,
remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel. 解决方式: [root@localhost mysql]# yum install ncurses-devel.x86_64 [root@localhost mysql]#make clean [root@localhost mysql]#rm -rf CMakeCache.txt [root@localhost mysql]# cmake . -LH -- -- MySQL 5.5.21 -- Configuring done -- Generating done -- Build files have been written to: /data/mysql -- Cache values // Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel CMAKE_BUILD_TYPE:STRING=RelWithDebInfo
// install prefix CMAKE_INSTALL_PREFIX:PATH=/usr/local/mysql
// Set to true if this is a community build COMMUNITY_BUILD:BOOL=ON
// Enable profiling ENABLED_PROFILING:BOOL=ON
// Enable debug sync (debug builds only) ENABLE_DEBUG_SYNC:BOOL=ON
// Enable gcov (debug, Linux builds only) ENABLE_GCOV:BOOL=OFF
// Installation directory layout. Options are: STANDALONE (as in zip or tar.gz installer), RPM, DEB, SVR4 INSTALL_LAYOUT:STRING=STANDALONE
// default MySQL data directory MYSQL_DATADIR:PATH=/usr/local/mysql/data
// MySQL maintainer-specific development environment MYSQL_MAINTAINER_MODE:BOOL=OFF
// Link ARCHIVE statically to the server WITH_ARCHIVE_STORAGE_ENGINE:BOOL=OFF
// Link BLACKHOLE statically to the server WITH_BLACKHOLE_STORAGE_ENGINE:BOOL=OFF
// Use dbug/safemutex WITH_DEBUG:BOOL=OFF
// Compile MySQL with embedded server WITH_EMBEDDED_SERVER:BOOL=OFF
// Options are: none, complex, all 字符串 WITH_EXTRA_CHARSETS:STRING=all
// Link FEDERATED statically to the server WITH_FEDERATED_STORAGE_ENGINE:BOOL=OFF
// Link INNOBASE statically to the server 静态编译innodb WITH_INNOBASE_STORAGE_ENGINE:BOOL=ON
// Use bundled libedit WITH_LIBEDIT:BOOL=ON
// Compile with tcp wrappers support WITH_LIBWRAP:BOOL=OFF
// Link PARTITION statically to the server 静态编译分区 WITH_PARTITION_STORAGE_ENGINE:BOOL=ON
// Link PERFSCHEMA statically to the server WITH_PERFSCHEMA_STORAGE_ENGINE:BOOL=ON
// Generate PIC objects WITH_PIC:BOOL=OFF
// Use bundled readline WITH_READLINE:BOOL=OFF
// Options are : no, bundled, yes (prefer os library if present otherwise use bundled), system (use os library) WITH_SSL:STRING=no
// Compile MySQL with unit tests WITH_UNIT_TESTS:BOOL=ON
// Valgrind instrumentation WITH_VALGRIND:BOOL=OFF
// Use bundled zlib WITH_ZLIB:STRING=bundled
shell> cmake -L
Gives a brief overview of important configuration parameters (dump to stdout)
shell> cmake -LH
Does the same but also provides a short help text for each parameter.
shell> cmake -LAH
Dumps all config parameters (including advanced) to the stdout.
MYSQL参数; http://dev./doc/refman/5.5/en/source-configuration-options.html
MYSQL编译参数 cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ -DMYSQL_DATADIR=/data/dbdata \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_PARTITION_STORAGE_ENGINE=1 \ -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DMYSQL_UNIX_ADDR=/usr/local/mysql/tmp/mysql.sock \ -DMYSQL_TCP_PORT=3306 \ -DENABLED_LOCAL_INFILE=1 \ -DWITH_EXTRA_CHARSETS=all \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DWITH_SSL=yes
[root@localhost ~]make . [root@localhost ~]# make [root@localhost ~]# make install # End of source-build specific instructions # Postinstallation setup shell> cd /usr/local/mysql shell> chown -R mysql.mysql /usr/local/mysql [root@localhost mysql]# scripts/mysql_install_db --user=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:
./bin/mysqladmin -u root password 'new-password' ./bin/mysqladmin -u root -h localhost.localdomain password 'new-password'
Alternatively you can run: ./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 . ; ./bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl cd ./mysql-test ; perl mysql-test-run.pl
Please report any problems with the ./bin/mysqlbug script! shell> cp support-files/my-medium.cnf /etc/my.cnf shell> bin/mysqld_safe --user=mysql & # Next command is optional //查看MYSQL是否正常启动 [root@localhost mysql]# ps -ef|grep mysql root 12381 2182 0 17:21 pts/0 00:00:00 /bin/sh bin/mysqld_safe --user=mysql mysql 12637 12381 0 17:21 pts/0 00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/dbdata --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/dbdata/localhost.localdomain.err --pid-file=/data/dbdata/localhost.localdomain.pid --socket=/usr/local/mysql/tmp/mysql.sock --port=3306 root 12706 2236 0 18:45 pts/1 00:00:00 grep mysql shell> cp support-files/mysql.server /etc/init.d/mysql.server [root@localhost ~]# chmod +w /usr/local/mysql [root@localhost ~]# chown -R mysql:mysql /usr/local/mysql #改变目录拥有者与所属组
[root@localhost ~]# ln -s /usr/local/mysql/lib/libmysqlclient.so.16 /usr/lib/libmysqlclient.so.16 [root@localhost ~]# cd support-files/ [root@localhost ~]# cp my-large.cnf /etc/my.cnf # 选择默认 配置文件 适合大型服务器 [root@localhost ~]# cp mysql.server /etc/init.d/mysqld # 复制启动文件 将 mysql 加入开机启动 [root@localhost ~]# chmod +x /etc/init.d/mysqld [root@localhost ~]# vi /etc/init.d/mysqld (编辑此文件,查找并修改以下变量内容:) basedir=/usr/local/mysql datadir=/var/mysql/data
[root@localhost ~]# chkconfig --add mysqld [root@localhost ~]# chkconfig --level 345 mysqld on
启动 mysql [root@localhost ~]# service mysqld start 给mysql设置密码,mysql默认密码为空 通过登录mysql系统, # mysql -uroot -p Enter password: 【输入原来的密码】默认密码为空,直接按回车键 mysql>use mysql; mysql> update user set password=passworD("test") where user='root'; mysql> flush privileges; mysql> exit; mysql安装好,默认没有打开远程访问,下面打开远程访问方法 通过登录mysql系统, # mysql -uroot -p Enter password: 输入密码成功登录后 mysql>use mysql;
mysql>update user set host = '%' where user = 'root';
mysql>select host, user from user; mysql> flush privileges; mysql> exit; 这就完事了,第一次写很乱,希望能帮助大家。 ps: rpm -ql 软件名 查看软件安装位置 rpm -qa | grep 软件名 查看软件是否安装
|