安装&&配置环境变量:
1.jdk 7
解压 tar -xvf jdk-7u25-Linux-x64.tar.gz
移动到/opt/目录下 sudo mv jdk1.7.0_25/ /opt/
配置环境变量
1
2
3
|
PATH= "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/jdk1.7.0_25/bin" CLASS_PATH= "/opt/jdk1.7.0_25/lib" JAVA_HOME= "/opt/jdk1.7.0_25" |
执行Java,javac命令 :
sudo update-alternatives --install /usr/bin/Java java /opt/jdk1.7.0_25/bin/java 300
sudo update-alternatives --install /usr/bin/javac javac /opt/jdk1.7.0_25/bin/javac 300
选择默认版本:
sudo update-alternatives --config java
测试是否正常:
java java -version javac
2.tomcat
tomcat比较容易安装,解压,移动到opt下,tomcat/bin/下有启动和关闭脚本,运行即可。
注意权限问题。
3.mysql 5.6
安装tar包mysql-5.6.13-linux-glibc2.5-x86_64.tar.gz
解压 tar -zxvf mysql-5.6.13-linux-glibc2.5-x86_64.tar.gz
重命名 mv mysql-5.6.13-linux-glibc2.5-x86_64 mysql5.6
转移 sudo mv mysql5.6 /opt/
进入mysql文件夹 cd mysql5.6/
增加mysql用户组和用户:
sudo groupadd mysql
sudo useradd -r -g mysql mysql
改变mysql5.6文件夹所属用户和用户组:
sudo chown -R mysql .
sudo chgrp -R mysql .
执行安装脚本:
sudo scripts/mysql_install_db --user=mysql
报错:Installing MySQL system tables..../bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
需要安装libaio.so.1,执行:
sudo apt-get install libaio-dev
安装libaio后再运行mysql安装脚本即可安装成功
将权限变更回来,仅保留data目录为mysql用户
sudo chown -R root .
sudo chown -R mysql data
将mysql配置文件拷贝到etc目录下(全局配置)
sudo cp support-files/my-default.cnf /etc/my.cnf
在Mysql5.6目录下启动mysql:
/opt/mysql5.6$ sudo bin/mysqld_safe --user=mysql&
初始化mysql的密码:
sudo bin/mysqladmin -u root password '111111'
修改mysql.server的basepath
vim support-files/mysql.server 为当前目录,文件默认路径为:/usr/local/mysql,偷懒的同学可以一开始就复制到这个目录下,
复制mysql.server脚本到/etc/init.d(初始化服务)
sudo cp support-files/mysql.server /etc/init.d/mysql.server
查看mysql运行状态:
sudo service mysql.server status
启动关闭:
sudo service mysql.server start|stop
设在mysql开机启动:defaults开机启动,remove取消开机启动
sudo update-rc.d -f mysql.server defaults | [remove]
将mysql命令加入到命令中或者将mysql的bin目录加入环境变量
sudo ln -s bin/mysql /usr/local/bin/mysql
export PATH=$PATH:/opt/mysql5.6/bin
允许root用户远程登陆:
mysql -u root -p
全部主机登陆
grant all privileges on *.* to root@"%" identified by "111111" with grant option;
指定主机登陆
grant all privileges on *.* to root@"192.168.1.101" identified by "passw0rd" with grant option;
授权生效:flush privileges;
补充:装完workbench后忽然启动报错,参考一下解决
1
2
3
4
5
6
7
8
9
10
11
|
cp support-files/mysql.server /etc/init.d/mysql chmod +x /etc/init.d/mysql vim mysql #修改以下两个变量 basedir=/home/software/mysql- 5.5 . 20 datadir=/home/software/mysql- 5.5 . 20 /data 然后执行 update-rc.d mysql defaults #再使用service mysql start来尝试启动,报错: #Couldn't find MySQL server (/usr/bin/mysqld_safe),路径不对,不应该到/usr/bin下寻找mysqld_safe,怀疑mysql启动时加载配置文件出错,mysql配置文件的读取顺序为: /etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf 挨个查看,发现 /etc/mysql/my.cnf中的以上两个对应值不正确,修改后测试,发现可用service mysql start来启动mysql |
4.mysql workbench
安装 mysql-workbench-community-6.0.6-1ubu1304-amd64.deb版本,简单省事....
实践证实这是最Fuck的方法.........具体看下文..........
5.eclipse javaee
解压:tar -xvf
移动到/opt目录:mv eclipse /opt
修改用户组和权限:
sudo chown -R root:root eclipse/
sudo chmod -R +r eclipse
sudo chmod +x `sudo find eclipse -type d`
建立可执行方式:
sudo touch /usr/bin/eclipse
sudo chmod 755 /usr/bin/eclipse
sudo vim /usr/bin/eclipse 加入如下:
1
2
3
|
#!/bin/sh export ECLIPSE_HOME= "/opt/eclipse" $ECLIPSE_HOME /eclipse $* |
建立快捷启动方式:
sudo vim /usr/share/applications/eclipse.desktop 加入如下:
1
2
3
4
5
6
7
8
9
10
|
[Desktop Entry] Encoding=UTF-8 Name=Eclipse Comment=Eclipse IDE Exec=eclipse Icon=/opt/eclipse/icon.xpm Terminal=false Type=Application Categories=GNOME;Application;Development; StartupNotify=true |
初始化Eclipse:
/opt/eclipse/eclipse -clean
everythin is ok !尽情体验吧~~
补充:
rar解压工具:sudo apt-get install rar unrar
mysql安装补充:
按照上述方式装完mysql后,正常启动,再安装mysql workbench时候都正常.......此时mysql workbench会自动生成一个/etc/mysql/my.cnf的文件,用mysql.service启动脚步中会调用到此文件,此文件为mysql5.5的格式,直接后果就是导致Mysql5.6无法启动!!不管怎么改都不行.....最后从mysql安装目录下复制my.cnf覆盖,启动,成功................
workbench生成的5.5那个配置文件的日志文件路径/var/log/mysql/error.err,需要把这个文件建上,mysql不会自动生存,就可以看到报错日志了。
命令行登录mysql报错:Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock
修改/etc/mysql/my.cnf的socket配置,
[client]
socket = /tmp/mysql.sock
[mysqld]
socket = /tmp/mysql.sock
重启mysql