Linux部署

1.即便是新的linux服務器,也要先驗證是否有mysql已經安裝,若是有進行卸載原版本,必定要確認是否mysql已再也不使用
原安裝狀況
  whereis mysql
  rpm -qa | grep -i mysql
  rpm -e perl-DBD-MySQL-4.013-3.el6.x86_64mysql

2.生成文件目錄
  find / -name mysql
  rm -rflinux

3.建立目錄 sql

  /usr/local/yxc
  cd /usr/local/yxc
4.複製安裝文件到此目錄數據庫

5.linux系統是否是64位
  getconf LONG_BITapache

6.mysql 安裝
  解壓安裝包:進入安裝包所在目錄,執行命令:
  tar -zxvf mysql-5.5.50-linux2.6-x86_64.tar.gztomcat

  複製解壓後的mysql目錄到系統的本地軟件目錄:執行命令:
  cp mysql-5.5.50-linux2.6-x86_64 /usr/local/mysql -r服務器

7.添加系統mysql組和mysql用戶:執行命令:
  groupadd mysql
  useradd -r -g mysql mysqlsocket

8.安裝數據庫:
  進入安裝mysql軟件目錄:執行命令
  cd /usr/local/mysqlui

9.修改當前目錄擁有者爲mysql用戶:執行命令
  chown -R mysql:mysql ./rest

10.安裝數據庫:執行命令
  ./scripts/mysql_install_db --user=mysql

11.修改當前目錄擁有者爲root用戶:執行命令
chown -R root:root ./

12.修改當前data目錄擁有者爲mysql用戶:執行命令
  chown -R mysql:mysql data

13.到此數據庫安裝完畢
  啓動mysql服務和添加開機啓動mysql服務:
  添加開機啓動:執行命令
  cp support-files/mysql.server /etc/init.d/mysql

  chkconfig --add mysql
  chkconfig mysql on

14.把啓動腳本放到開機初始化目錄
  啓動mysql服務:執行命令
  service mysql start

  ps -ef|grep mysqld

15.修改mysql的root用戶密碼,root初始密碼爲空的:
  執行命令:./bin/mysqladmin -u root password 'xinyang906'
  若是報錯

16.把mysql客戶端放到默認路徑:
  ln -s /usr/local/mysql/bin/mysql /usr/local/bin/mysql

問題提示:
  error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'
  ####執行:#ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
  /etc/my.cnf
  [mysqld]
  datadir=/var/lib/mysql
  # socket=/var/lib/mysql/mysql.sock
  socket=/tmp/mysql.sock
  user=mysql
  # Disabling symbolic-links is recommended to prevent assorted security risks
  symbolic-links=0
  max_allowed_packet=10G
  character-set-server=utf8
  lower_case_table_names=1

  delayed_insert_limit=1000
  delayed_insert_timeout=300
  delayed_queue_size=5000
  max_connections=400
  thread_cache=8
  innodb_buffer_pool_size=1073741824

  [mysqld_safe]
  log-error=/var/log/mysqld.log
  pid-file=/var/run/mysqld/mysqld.pid

17.###從新啓動數據庫
  service mysql restart

  mysql -uroot -p
  select * from mysql.user;
  UPDATE mysql.user SET Password=PASSWORD('xinyang906') where USER='root';

  GRANT ALL PRIVILEGES ON *.* TO 'hexm'@'%' IDENTIFIED BY 'tarenahexm1989' WITH GRANT OPTION;

  set global interactive_timeout = 2880000
  set global max_allowed_packet = 904857600

  FLUSH PRIVILEGES;
quit

18.jdk 安裝
  cd /usr/local/yxc
  tar -zxvf jdk-7u79-linux-x64.tar.gz
  mv jdk1.7.0_79/ /usr/local/jdk7/

  vi /etc/profile

  for i in /etc/profile.d/*.sh ; do
  if [ -r "$i" ]; then
  if [ "${-#*i}" != "$-" ]; then
  . "$i"
  else
  . "$i" >/dev/null 2>&1
  fi
  fi
  done

JAVA_HOME=/usr/local/jdk7
JRE_HOME=/usr/local/jdk7/jre
PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
export JAVA_HOME JRE_HOME PATH CLASSPATH

  unset i
  unset -f pathmunge

    source /etc/profile

 

tomcat 安裝
tar -zxvf apache-tomcat-7.0.65.tar.gz

啓動命令/usr/local/yxc/apache-tomcat-7.0.65/bin/startup.sh 中止命令/usr/local/yxc/apache-tomcat-7.0.65/bin/shutdown.sh

相關文章
相關標籤/搜索