====Permissions============== drwxr-xr-x d:directory read write execute -rw-r--r-- file rwx rx rx 111 101 101 7 5 5 users user group other group g u o 777 highest authority command to change authority: =========== chmod g(u/o)+(-)w file chmod 777 file name chmod 777 -R file name recursive authorization ( Subdirectories also get permissions) Add users and user groups: ============= Create user group:groupadd group name Delete user group:groupdel group name (only empty groups can be deleted) Create user group (Specify group id): groupadd -g 701 tomcat Specify the groupId of tomcat as 701 Create a user (under the specified group): useradd -g 701 tomcat Create a tomcat user under the specified groupId Modify the user password: passwd tomcat switch user su - tomcat * switch user: su - tomcat,
Pay attention to add -; the tomcat user-defined environment variable used by the environment variable === 3 ways to install the software under linux: ===== 1 rpm package is equivalent to windows exe, which belongs to binary installation 2 tar package, directly decompress and install 3 yum Installation (online installation of centos), prm installed online Common commands to install rpm: rpm -i install (install) rpm -ivh install and display progress = install JDK================ ======= Before installation, check whether JDK OpenJDK Community Edition jdk one has been installed; the environment variable of jdk can be set under the tomcat user without affecting other user environments . Use the command: chown Change the owner of the file chown tomcat /opt/software/jdk-7u67-linux-x64.rpm Note: To install software, use root to install rpm: rpm -ivh /opt/software/jdk-7u67-linux-x64.rpm II; under tomcat user, Configure jdk environment variables (user level): ===== 1 cd 2 ls -la (to view hidden files) 3 vi .bash_profile JAVA_HOME=/usr/java/jdk1.7.0_67 export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH:$HOME/bin 4 echo $PATH echo (delimiter is:) 5 Switch users (only effective), and finally configure the jdk environment variable under the java -version root user under the tomcat user ( system level):===== 1 vi etc/profile JAVA_HOME=/usr/java/jdk1.7.0_67 export JAVA_HOME PATH=$JAVA_HOME/bin:$PATH export PATH 2 source /etc/profile Make the configuration file take effect immediately = mysql installation: ============= 1 Find out if the rpm package of mysql has been installed rpm -qa | grep mysql rpm -e mysql-libs-5.1.71-1.el6.x86_64 Uninstall if yes Dependencies, need to be deleted: rpm -e mysql-libs-5.1.71-1.el6.x86_64 --nodeps
2 解tar
tar -xvf tar包 (解压到当前目录)
tar -xvf tar包 -C 大写C指定目录( man tar)
3 rpm安装顺序(先server 后client)
4 查mysql的进程启动状态
ps -ef|grep mysql
chkconfig --list 查看所有服务
service msyql start 启动mysql服务
5 进入mysql
mysql -u root -p (初始没有密码)
改初始密码
先
退出mysql:exit
再
mysqladmin -u root -p password
Enter password: //直接Enter,因为初始没有密码
New password: //设置新密码
Confirm new password:
6 修改mysql的字符集--
show variables like 'chara%'; --查看字符集是否设置为u8
mysql> show variables like 'chara%'; +--------------------------+----------------------------+ | Variable_name | Value | +--------------------------+----------------------------+ | character_set_client | utf8 | | character_set_connection | utf8 | | character_set_database | latin1 | | character_set_filesystem | binary | | character_set_results | utf8 | | character_set_server | latin1 | | character_set_system | utf8 | | character_sets_dir | /usr/share/mysql/charsets/ | +--------------------------+----------------------------+ 8 rows in set (0.00 sec)
通过修改配置文件,改字符编码
配置文件在:/usr/share/mysql/my-small.cnf
需要把my-small.cnf拷贝到etc目录下作为一个全局配置文件
[tomcat@mylinux mysql]$ cat my-small.cnf # Example MySQL config file for small systems. # # This is for a system with little memory (<= 64M) where MySQL is only used # from time to time and it's important that the mysqld daemon # doesn't use much resources. # # MySQL programs look for option files in a set of # locations which depend on the deployment platform. # You can copy this option file to one of those # locations. For information about these locations, see: # http://dev.mysql.com/doc/mysql/en/option-files.html # # 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-external-locking key_buffer_size = 16K max_allowed_packet = 1M table_open_cache = 4 sort_buffer_size = 64K read_buffer_size = 256K read_rnd_buffer_size = 256K net_buffer_length = 2K thread_stack = 128K # Don't listen on a TCP/IP port at all. This can be a security enhancement, # if all processes that need to connect to mysqld run on the same host. # All interaction with mysqld must be made via Unix sockets or named pipes. # Note that using this option without enabling named pipes on Windows # (using the "enable-named-pipe" option) will render mysqld useless! # #skip-networking server-id = 1 # Uncomment the following if you want to log updates #log-bin=mysql-bin # binary logging format - mixed recommended #binlog_format=mixed # Causes updates to non-transactional engines using statement format to be # written directly to binary log. Before using this option make sure that # there are no dependencies between transactional and non-transactional # tables such as in the statement INSERT INTO t_myisam SELECT * FROM # t_innodb; otherwise, slaves may diverge from the master. #binlog_direct_non_transactional_updates=TRUE # Uncomment the following if you are using InnoDB tables #innodb_data_home_dir = /var/lib/mysql #innodb_data_file_path = ibdata1:10M:autoextend #innodb_log_group_home_dir = /var/lib/mysql # You can set .._buffer_pool_size up to 50 - 80 % # of RAM but beware of setting memory usage too high #innodb_buffer_pool_size = 16M #innodb_additional_mem_pool_size = 2M # Set .._log_file_size to 25 % of buffer pool size #innodb_log_file_size = 5M #innodb_log_buffer_size = 8M #innodb_flush_log_at_trx_commit = 1 #innodb_lock_wait_timeout = 50 [mysqldump] quick max_allowed_packet = 16M [mysql] no-auto-rehash # Remove the next comment character if you are not familiar with SQL #safe-updates [myisamchk] key_buffer_size = 8M sort_buffer_size = 8M [mysqlhotcopy] interactive-timeout [tomcat@mylinux mysql]$
查找/etc目录下是否有my.cnf文件;
ls -l | grep my.cnf (在/etc下查找是否有my.cnf文件存在)
拷贝my-small.cnf到etc目录下,名my.cnf:
cp /usr/share/mysql/my-small.cnf /etc/my.cnf
在[mysqld]下面加上设置:
character_set_server = utf8
修改完成之后,重启mysql服务
service mysql restart
7 关闭防火墙 (service iptables stop) 不可取
开启端口:
iptables -I INPUT -p tcp --dport 3306 -j ACCEPT 开放3306端口
service iptables save 保存配置
8 查看mysql的日志 (看mysql的报错等)
cd /var/lib/mysql
9 SQLYoung访问,需要授权
登录mysql后(%是全部ip可登陆,也可换成指定ip/也可以把root用户换成别的用户)
MYSQL--> grant all privileges on *.* to root@'%'
identified by 'root用户密码' with grant option;
flush privileges; 刷新mysql的系统权限相关表
=tomcat安装==================
1 解压tar包
tar -xvf tar包 -C 指定目录
( 解压zip包
unzip )
2 放开端口
iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
service iptables save 保存配置
3 ./ 执行
启动tomcat ./startup.sh
停止tomcat ./shutdown.sh
4 查看日志: tail -f log日志文件