阿里雲linux服務器初步使用

tomcat 安裝html

進到/usr/local/apache執行命令 java

wget http://mirrors.cnnic.cn/apache/tomcat/tomcat-7/v7.0.57/bin/apache-tomcat-7.0.57.tar.gzmysql

而後解壓linux

tar-zxvf apache-tomcat-7.0.57.tar.gzweb

查看sql

[root@iZ94l1n0y28Z apache]# ls數據庫

apache-tomcat-7.0.57  apache-tomcat-7.0.57.tar.gzapache

[root@iZ94l1n0y28Z apache]# cd apache-tomcat-7.0.57centos

[root@iZ94l1n0y28Z apache-tomcat-7.0.57]# lstomcat

bin   lib      logs    RELEASE-NOTES  temp     work

conf  LICENSE  NOTICE  RUNNING.txt    webapps

[root@iZ94l1n0y28Z apache-tomcat-7.0.57]# 

tomcat 啓動  

切換到tomcat 的bin路徑下執行 ./startup.sh

tomcat 關閉

 ./shutdown.sh


查看tomcat運行實時日記

切換到tomcat的logs目錄下

運行 

tail -f catalina.out




jdk安裝

[root@iZ94l1n0y28Z local]# mkdir java

[root@iZ94l1n0y28Z local]# ls

aegis   bin  games    java  lib64    sbin   src

apache  etc  include  lib   libexec  share

[root@iZ94l1n0y28Z local]# cd java

[root@iZ94l1n0y28Z java]# wget http://download.oracle.com/otn-pub/java/jdk/7u71-b14/jdk-7u71-linux-x64.tar.gz

解壓jdk  

而後一直不行。

最後直接在window下,下載好文件 而後經過ssh傳到阿里雲服務器

下載地址

http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

如圖

此次終於解壓成功!

解壓後

配置環境變量

     vi /etc/profile

    export JAVA_HOME = /usr/local/java/jdk1.7xxx
    export PATH = $JAVA_HOME/bin:$PATH

    export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

注意這裏:

export JAVA_HOME=/usr/local/java/jdk1.7.0_71

export PATH=$JAVA_HOME/bin:$PATH

export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar


=號左右2邊不要有空格否則啓動時候報這個錯:-bash: export: `=': not a valid identifier


mysql安裝

mysql安裝花了我比較多的時間

要安裝的有3個

MySQL-server-5.0.96-1.glibc23.x86_64.rpm

MySQL-shared-compat-5.0.96-1.glibc23.x86_64.rpm

MySQL-client-5.0.96-1.glibc23.x86_64.rpm


一開始執行# rpm -ivh MySQL-server-5.0.96-1.glibc23.x86_64.rpm的時候拋下面的錯誤

   MySQL conflicts with mysql-5.1.73-3.el6_5.x86_64



[root@iZ94l1n0y28Z mysql]# rpm -ivh MySQL-server-5.0.96-1.glibc23.x86_64.rpm

error: Failed dependencies:

        libmysqlclient.so.15()(64bit) is needed by MySQL-server-5.0.96-1.glibc23.x86_64

        libmysqlclient.so.15(libmysqlclient_15)(64bit) is needed by MySQL-server-5.0.96-


1.glibc23.x86_64

解決方案:

要裝這個

http://mysql.mirror.kangaroot.net/Downloads/MySQL-5.0/MySQL-shared-compat-5.0.96-1.glibc23.x86_64.rpm


安裝server的時候遇到這個問題:

[root@iZ94l1n0y28Z mysql]# rpm -ivh MySQL-server-5.0.96-1.glibc23.x86_64.rpm

error: Failed dependencies:

        libmysqlclient.so.15()(64bit) is needed by MySQL-server-5.0.96-1.glibc23.x86_64

        libmysqlclient.so.15(libmysqlclient_15)(64bit) is needed by MySQL-server-5.0.96-


1.glibc23.x86_64

        MySQL conflicts with mysql-5.1.73-3.el6_5.x86_64

[root@iZ94l1n0y28Z mysql]# rpm -qa | grep -i libs | grep -i mysql

mysql-libs-5.1.73-3.el6_5.x86_64

[root@iZ94l1n0y28Z mysql]# rpm -e mysql-libs-5.1.73-3.el6_5.x86_64

error: Failed dependencies:

        libmysqlclient.so.16()(64bit) is needed by (installed) postfix-2:2.6.6-6.el6_5.x86_64

        libmysqlclient.so.16()(64bit) is needed by (installed) mysql-5.1.73-3.el6_5.x86_64

        libmysqlclient.so.16(libmysqlclient_16)(64bit) is needed by (installed) postfix-2:2.6.6-


6.el6_5.x86_64

        libmysqlclient.so.16(libmysqlclient_16)(64bit) is needed by (installed) mysql-5.1.73-


3.el6_5.x86_64

        libmysqlclient_r.so.16()(64bit) is needed by (installed) mysql-5.1.73-3.el6_5.x86_64

        libmysqlclient_r.so.16(libmysqlclient_16)(64bit) is needed by (installed) mysql-5.1.73-


3.el6_5.x86_64

        mysql-libs is needed by (installed) postfix-2:2.6.6-6.el6_5.x86_64

        mysql-libs = 5.1.73-3.el6_5 is needed by (installed) mysql-5.1.73-3.el6_5.x86_64

[root@iZ94l1n0y28Z mysql]# rpm -e mysql-libs

error: Failed dependencies:

        libmysqlclient.so.16()(64bit) is needed by (installed) postfix-2:2.6.6-6.el6_5.x86_64

        libmysqlclient.so.16()(64bit) is needed by (installed) mysql-5.1.73-3.el6_5.x86_64

        libmysqlclient.so.16(libmysqlclient_16)(64bit) is needed by (installed) postfix-2:2.6.6-


6.el6_5.x86_64

        libmysqlclient.so.16(libmysqlclient_16)(64bit) is needed by (installed) mysql-5.1.73-


3.el6_5.x86_64

        libmysqlclient_r.so.16()(64bit) is needed by (installed) mysql-5.1.73-3.el6_5.x86_64

        libmysqlclient_r.so.16(libmysqlclient_16)(64bit) is needed by (installed) mysql-5.1.73-


3.el6_5.x86_64

        mysql-libs is needed by (installed) postfix-2:2.6.6-6.el6_5.x86_64

        mysql-libs = 5.1.73-3.el6_5 is needed by (installed) mysql-5.1.73-3.el6_5.x86_64

[root@iZ94l1n0y28Z mysql]# rpm -ivh MySQL-server-5.0.96-1.glibc23.x86_64.rpm

error: Failed dependencies:

        libmysqlclient.so.15()(64bit) is needed by MySQL-server-5.0.96-1.glibc23.x86_64

        libmysqlclient.so.15(libmysqlclient_15)(64bit) is needed by MySQL-server-5.0.96-


1.glibc23.x86_64

        MySQL conflicts with mysql-5.1.73-3.el6_5.x86_64


後來找到方法就是:將系統預裝的刪除掉

[root@iZ94l1n0y28Z mysql]# yum -y remove mysql-libs-5.1.73-3.el6_5.x86_64

刪除掉以後遇到了下面的問題

[root@iZ94l1n0y28Z mysql]# rpm -ivh MySQL-server-5.0.96-1.glibc23.x86_64.rpm

error: Failed dependencies:

        libmysqlclient.so.15()(64bit) is needed by MySQL-server-5.0.96-1.glibc23.x86_64

        libmysqlclient.so.15(libmysqlclient_15)(64bit) is needed by MySQL-server-5.0.96-


1.glibc23.x86_64

找到解決方法就是以下安裝這個:

[root@iZ94l1n0y28Z mysql]# wget http://mysql.mirror.kangaroot.net/Downloads/MySQL-5.0/MySQL-shared-


compat-5.0.96-1.glibc23.x86_64.rpm

[root@iZ94l1n0y28Z mysql]# rpm -ivh MySQL-shared-compat-5.0.96-1.glibc23.x86_64.rpm

Preparing...                ########################################### [100%]

   1:MySQL-shared-compat    ########################################### [100%]

[root@iZ94l1n0y28Z mysql]# rpm -ivh MySQL-server-5.0.96-1.glibc23.x86_64.rpm

Preparing...                ########################################### [100%]

   1:MySQL-server           ########################################### [100%]

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !

To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'

/usr/bin/mysqladmin -u root -h iZ94l1n0y28Z password 'new-password'


Alternatively you can run:

/usr/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.


Please report any problems with the /usr/bin/mysqlbug script!


The latest information about MySQL is available on the web at

http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

Starting MySQL. SUCCESS! 

[root@iZ94l1n0y28Z mysql


這個時候還不能夠用MySQL命令行

還得安裝MySQL-client-5.0.96-1.glibc23.x86_64.rpm


總而言之要將原來系統自帶的幹掉

而後按照這個順序分別安裝,至於其餘順序我沒試過

MySQL-server-5.0.96-1.glibc23.x86_64.rpm

MySQL-shared-compat-5.0.96-1.glibc23.x86_64.rpm

MySQL-client-5.0.96-1.glibc23.x86_64.rpm


上面3個資源路徑以下:

路徑分別是

http://mysql.mirror.kangaroot.net/Downloads/MySQL-5.0/MySQL-server-5.0.96-1.glibc23.x86_64.rpm

http://mysql.mirror.kangaroot.net/Downloads/MySQL-5.0/MySQL-shared-compat-5.0.96-1.glibc23.x86_64.rpm

http://mysql.mirror.kangaroot.net/Downloads/MySQL-5.0/MySQL-client-5.0.96-1.glibc23.x86_64.rpm 


鏈接數據庫

[root@iZ94l1n0y28Z mysql]# mysql -u root 




設置數據庫編碼


/usr/share/doc/mysql-server-xxxx中的my-large.cnf複製到/etc/my.cnf

先經過vi 打開 my-large.cnf(i進入編輯模式,按esc退出編輯模式,按:wq退出而且保存該文件)


# Example MySQL config file for large systems.

#

# This is for a large system with memory = 512M where the system runs mainly

# MySQL.

#

# You can copy this file to

# /etc/my.cnf to set global options,

# mysql-data-dir/my.cnf to set server-specific options (in this

# installation this directory is /var/lib/mysql) or

# ~/.my.cnf to set user-specific options.

#

# In this file, you can use all long options that a program supports.

# If you want to know which options a program supports, run the program

# with the "--help" option.


# The following options will be passed to all MySQL clients

[client]

#password       = your_password

port            = 3306

socket          = /var/lib/mysql/mysql.sock


# Here follows entries for some specific programs


# The MySQL server

[mysqld]

port            = 3306

socket          = /var/lib/mysql/mysql.sock

skip-locking

key_buffer = 256M

max_allowed_packet = 1M

table_cache = 256

sort_buffer_size = 1M

read_buffer_size = 1M

read_rnd_buffer_size = 4M

myisam_sort_buffer_size = 64M

thread_cache_size = 8

query_cache_size= 16M

# Try number of CPU's*2 for thread_concurrency

thread_concurrency = 8



2. 打開my.cnf,修改編碼(注意:my.cnf是爲了設置全局變量?能夠將上面的內容複製到這個文件以後再改下面的)

    在[client]下,增長default-character-set=utf8

在[mysqld]下增長default-character-set=utf8 和 init_connect='SET NAMES utf8'

參考文章:

  1. 如何遠程鏈接阿里雲主機服務器(Linux系統)

  2. Linux下Tomcat的安裝配置

  3. 阿里雲 安裝 tomcat

  4. vi 使用規則

  5. mysql-5.1.60-linux-x86_64-glibc23 安裝

  6. 在阿里雲Linux服務器上安裝MySQL

  7. 阿里雲centos6.5安裝 mysql

  8. 【MySQL案例】mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package Perco

  9. libmysqlclient.so.15()(64bit) is needed by perl-DBD-MySQL-3.0007-2.el5.x86_64的解決方法

  10. 在阿里雲Linux服務器上安裝MySQL

  11. MySQL遠程訪問權限,容許遠程鏈接的開啓

  12. Linux 刪除文件夾和文件的命令

  13. linux下打開、關閉tomcat,實時查看tomcat運行日誌

  14. linux下mysql的遠程鏈接

相關文章
相關標籤/搜索