CentOS
IP
输入 ifconfig 可以查看到当前本机的IP地址信息
http://www.cnblogs.com/Jack-hui/p/3579162.html
java: /usr/bin/java /etc/java /usr/lib/java /usr/share/java
export JAVA_HOME=/usr/java/jdk1.7.0_79
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tool.jar
--安装tomcat---
wget http://mirrors.cnnic.cn/apache/tomcat/tomcat-7/v7.0.65/bin/apache-tomcat-7.0.65.tar.gz
tar -zxvf apache-tomcat-7.0.65.tar.gz
mv apache-tomcat-7.0.65 /usr/local/tomcat
cd /usr/local/tomcat/bin
bash startup.sh //直接输入startup.sh 报 –bash错误的话,在命令前面加上bash
不能访问tomcat
win7访问不了局域网里Linux上的tomcat服务的问题
背景:宿主机-windows 7
virtualbox里安装centos,centos与宿主机windows 7是桥接。
在centos里启动了tomcat服务,在本机centos里可以用localhost:8080访问。
但是在windows 7里不能访问。
解决方案:在centos里把iptables关闭即可解决。
命令:service iptables stop
--FFmpeg 安装-----------
install mercurial //hg: not found
yum install -y git //如果git不能用
http://trac.ffmpeg.org/wiki/CompilationGuide/Centos
源代码获取地址:
git clone https://chromium.googlesource.com/webm/libvpx
上述地址有可能访问不了,可以使用下面的镜像地址:
git clone https://github.com/webmproject/libvpx
----
Mplayer
yum -y install svn
yum -y install wget
yum -y install yasm
yum -y install gtk2-devel
yum -y install make
yum -y install gcc
yum -y install git
wget http://www.mplayerhq.hu/MPlayer/releases/codecs/essential-amd64-20071007.tar.bz2
tar -xaf essential-amd64-20071007.tar.bz2
mkdir /usr/local/lib/codecs
cp essential-amd64-20071007/* /usr/local/lib/codecs
svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
cd mplayer
svn update
./configure –enable-gui –language=zh_CN
make
make install
wget http://www.mplayerhq.hu/MPlayer/skins/Clearlooks-1.6.tar.bz2
tar -xaf Clearlooks-1.6.tar.bz2
cp -R Clearlooks /usr/local/share/mplayer/skins/
ln -s Clearlooks default
----
FFMpeg转码由此得到的mp4文件中, meta信息是在文件尾部的, 而Flash Player在没有得到meta信息前不会播放文件, 因此只有等到文件完全下载完视频才会播放. 因此可以使用qt-faststart来把meta信息移到文件头部. 用法: /usr/bin/qt-faststart INPUT OUTPUT
qt-faststart安装方法:
进入FFMpeg安装目录,执行命令:
$ cd ffmpeg
$ ./configure
$ make tools/qt-faststart
$ cp -a tools/qt-faststart /usr/bin/
这样qt-faststart就安装好了。
假设转码后的文件名字为a.mp4,执行以下命令:
$ /usr/bin/qt-faststart a.mp4 b.mp4
再播放b.mp4就可以边加载边播放了。
//---------------------
/usr/local/nginx/sbin/nginx
/usr/local/nginx/sbin/nginx -s reload
打开tomcat
#执行
bin/startup.sh #启动tomcat
bin/shutdown.sh #停止tomcat
tail -f logs/catalina.out #看tomcat的控制台输出;
#看是否已经有tomcat在运行了
ps -ef |grep tomcat
#如果有,用kill;
kill -9 pid #pid 为相应的进程号
例如 ps -ef |grep tomcat 输出如下
sun 5144 1 0 10:21 pts/1 00:00:06 /java/jdk/bin/java -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/java/tomcat/common/endorsed -classpath :/java/tomcat/bin/bootstrap.jar:/java/tomcat/bin/commons-logging-api.jar -Dcatalina.base=/java/tomcat -Dcatalina.home=/java/tomcat -Djava.io.tmpdir=/java/tomcat/temp org.apache.catalina.startup.Bootstrap start
则 5144 就为进程号 pid = 5144
kill -9 5144 就可以彻底杀死tomcat
#直接查看指定端口的进程pid
netstat -anp|grep 9217
#结果为 tcp 0 0 :::9217 :::* LISTEN 26127/java
#则26127为9217这个端口的tomcat进程的pid,然后就可以kill这个进程
kill -9 26127
#然后再启动tomcat即可
[root@master ~]# ps -ef|grep tomcat [root@master ~]# kill -9 5413 [root@master ~]# ls [root@master ~]# cd apache-tomcat-7.0.67/ [root@master apache-tomcat-7.0.67]# ls [root@master bin]# ls [root@master bin]# sh startup.sh [root@master bin]# netstat -an|grep 8080
?? 启动:一般是执行sh tomcat/bin/startup.sh 停止:一般是执行sh tomcat/bin/shutdown.sh脚本命令 查看:执行ps -ef |grep tomcat 输出如下 *** 5144 。。。等等.Bootstrap start 说明tomcat已经正常启动, 5144 就为进程号 pid = 5144
杀死:kill -9 5144
------------------------linux下实时查看tomcat运行日志-------------------------
1、先切换到:cd tomcat/logs
2、tail -f catalina.out
3、这样运行时就可以实时查看运行日志了
Ctrl+c 是退出tail命令。
---------------------------mysql----------------------------------------------------
启动mysql 报错:
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)
1、先查看 /etc/rc.d/init.d/mysqld status 看看m y s q l 是否已经启动.
另外看看是不是权限问题.
2、确定你的mysql.sock是不是在那个位置,
mysql -u 你的mysql用户名 -p -S /var/lib/mysql/mysql.sock
3、试试:service mysqld start
4、如果是权限问题,则先改变权限 #chown -R mysql:mysql /var/lib/mysql
[root@localhost ~]# /etc/init.d/mysqld start
启动 MySQL: [ 确定 ]
[root@localhost ~]# mysql -uroot -p
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
原因是,/var/lib/mysql 的访问权限问题。
shell> chown -R mysql:mysql /var/lib/mysql
接着启动服务器
shell> /etc/init.d/mysql start
服务器正常启动后察看 /var/lib/mysql 自动生成mysql.sock文件。
但是我的问题仍然没有得到解决。
问题终于解决:
方法: 修改/etc/my.conf:
[mysqld]
datadir=/usr/local/mysql/data
socket=/var/lib/mysql/mysql.sock
[mysql.server]
user=mysql
basedir=/usr/local/mysql
If there is not currently a section called [client], add one at the bottom of the file and copy the socket= line under the [mysqld] section such as:
[client]
socket=/var/lib/mysql/mysql.sock
发现依旧如此,运行/etc/init.d/mysql start报错: Starting MySQLCouldn't find MySQL manager or server
是mysqld服务没启,运行/usr/local/mysql/bin/mysqld_safe &
mysql 显示所有的数据库,代码如下:
mysql> show database
-> ;
mysql> show tables;
MySQL显示命令
二、显示命令
1、显示数据库列表。
show databases;
2、显示库中的数据表:
use mysql;
show tables;
3、显示数据表的结构:
describe 表名;
4、建库:
create database 库名;
5、建表:
use 库名;
create table 表名 (字段设定列表);
6、删库和删表:
drop database 库名;
drop table 表名;
7、将表中记录清空:
delete from 表名;
8、显示表中的记录:
select * from 表名
---php--------------------------------------------------------------
[root@172-16-4-11 ~]# yum install httpd httpd-devel [root@172-16-4-11 ~]# sudo yum --enablerepo=remi install php Loaded plugins: fastestmirror, security [root@172-16-4-11 ~]# yum install php php-fpm [root@172-16-4-11 ~]# yum install php-gd php-mysql php-mbstring php-xml php-mcrypt [root@172-16-4-11 ~]# /usr/local/nginx/sbin/nginx –s reload nginx: invalid option: "–s" [root@172-16-4-11 ~]# /usr/local/nginx/sbin/nginx [root@172-16-4-11 ~]# /usr/local/nginx/sbin/nginx -s reload [root@172-16-4-11 ~]# /etc/init.d/php-fpm restart [root@172-16-4-11 ~]# /usr/local/nginx/sbin/nginx -s reload [root@172-16-4-11 ~]# /etc/init.d/php-fpm restart [root@172-16-4-11 ~]# /usr/local/nginx/sbin/nginx -s reload nginx: [emerg] directive "location" has no opening "{" in /usr/local/nginx/conf/nginx.conf:66 [root@172-16-4-11 ~]# /usr/local/nginx/sbin/nginx -s reload [root@172-16-4-11 ~]# /etc/init.d/php-fpm restart [root@172-16-4-11 ~]# /etc/init.d/php-fpm restart [root@172-16-4-11 ~]# /usr/local/nginx/sbin/nginx -s reload [root@172-16-4-11 ~]# /etc/init.d/httpd restart [root@172-16-4-11 ~]# /etc/init.d/httpd restart Stopping httpd: [FAILED] Starting httpd: [ OK ] [root@172-16-4-11 ~]# /etc/init.d/httpd restart Stopping httpd: [ OK ] Starting httpd: [ OK ] [root@172-16-4-11 ~]# /etc/init.d/iptables status Table: filter Chain INPUT (policy ACCEPT) num target prot opt source destination 1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED 2 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 3 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22 4 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:80 5 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:81 6 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:8080 7 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:9000 8 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:5666 9 ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:161 10 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 11 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited Chain FORWARD (policy ACCEPT) num target prot opt source destination 1 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited Chain OUTPUT (policy ACCEPT) num target prot opt source destination [root@172-16-4-11 ~]# /etc/init.d/httpd restart Stopping httpd: [ OK ] Starting httpd: [ OK ] [root@172-16-4-11 ~]# /usr/local/nginx/sbin/nginx -s reload [root@172-16-4-11 ~]# ps -ef | grep nginx root 7823 1 0 2015 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx nobody 30317 7823 0 15:26 ? 00:00:00 nginx: worker process root 31027 29158 0 16:15 pts/0 00:00:00 grep nginx [root@172-16-4-11 ~]# kill -9 nginx -bash: kill: nginx: arguments must be process or job IDs [root@172-16-4-11 ~]# -bash kill -9 nginx -bash: -bash: command not found [root@172-16-4-11 ~]# kill -QUIT 7823 [root@172-16-4-11 ~]# /etc/init.d/httpd restart Stopping httpd: [ OK ] Starting httpd: [ OK ] [root@172-16-4-11 ~]#