原因是linux 執(zhí)行sh文件里面缺少PATH=$PATH:/sbin,添加進即可。

成都創(chuàng)新互聯(lián)公司是一家集網(wǎng)站建設(shè),鹿泉企業(yè)網(wǎng)站建設(shè),鹿泉品牌網(wǎng)站建設(shè),網(wǎng)站定制,鹿泉網(wǎng)站建設(shè)報價,網(wǎng)絡(luò)營銷,網(wǎng)絡(luò)優(yōu)化,鹿泉網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強企業(yè)競爭力。可充分滿足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時我們時刻保持專業(yè)、時尚、前沿,時刻以成就客戶成長自我,堅持不斷學(xué)習、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實用型網(wǎng)站。
1、首先需要打開電腦的桌面,如圖所示,鼠標右鍵單擊選擇打開終端的選項。
2、然后就會進入頁面,如圖所示,在命令行輸入 gedit /etc/profile,回車。
3、然后就會彈出對話框,如圖所示,在下面的一行里面需要添加PATH=$PATH:/sbin。
4、最后,添加好之后,如圖所示,點擊左上角的保存即可完成操作解決問題了。
一、創(chuàng)建linux維護用戶
登錄root用戶
創(chuàng)建新用戶
useradd 新用戶名
設(shè)置用戶密碼
passwd 新用戶密碼
二、安裝jdk和配置環(huán)境變量
建議在root用戶下直接安裝jdk,并直接配置環(huán)境變量,同時給非root用戶設(shè)置讀和執(zhí)行權(quán)限
解壓包
tar xvf jdk包名.tar
配置全局變量
編輯/etc/profile文件
vi /etc/profile
按I鍵,切換成編輯模式。
在文件未加入一下配置
export JAVA_HOME=jdk的解壓文件目錄
export JRE_HOME=jdk的解壓文件目錄/jre
export?CLASSPATH=.:${JAVA_HOME}/lib:${?JRE_HOME}/lib:$CLASSPATH
export JAVA_PATH=${JAVA_HOME}/bin:${?JRE_HOME}/bin
export PATH=$PATH:${JAVA_PATH}
保存并退出
Esc ??
:wq
重載配置文件使其生效
source /etc/profile
檢查是否安裝成功
Javac
Java version
權(quán)限修改
讀4寫2執(zhí)行1,順序所有者、組成員、其他用戶
Chomd ?755 ?jdk的解壓文件目錄
三、安裝tomcat
安裝tomcat和放入war包使用非root的維護用戶
如果使用root安裝的話記得設(shè)置權(quán)限。( chomd -r 外層文件目錄 )
su - 用戶名
1、解壓包
tar ?xvf ?tomcat包名.tar
2、將war包放入tomcat/webapps目錄下
3、Tomcat啟動服務(wù)和停止服務(wù)
查看進程
ps -ef | grep java
啟動應(yīng)用
Tomcat bin目錄下.startup.sh
停止應(yīng)用
建議使用
Kill -9 進程號
注:解壓出應(yīng)用文件后,注意配置信息的修改
四、IBM MQ部署 (7.5之后的版本)
(以下是使用9.0版本的正確部署命令)
一、 卸載舊版本IBM MQ (可選)
因為部署環(huán)境沒有安裝過mq,卸載這部分命令我沒有親自測試過
設(shè)置環(huán)境
以用戶身份登錄到組mqm,找到mq的安裝位置 /opt/mqm
source ./setmqenv -s
查看隊列管理器的狀態(tài)
dspmq -o installation
停止與要卸載的安裝關(guān)聯(lián)的所有正在運行的隊列管理器
endmqm SXRECV
停止與隊列管理器關(guān)聯(lián)的所有偵聽器。
endmqlsr -m SXRECV
查看系統(tǒng)上當前安裝的軟件包(組件)
sudo rpm -qa | grep MQSeries
列出軟件包并一次性卸載
sudo rpm -qa | grep MQSeries | xargs rpm -ev
再將對應(yīng)的用戶及安裝目錄給刪除
rm -rf /opt/mqm
userdel -r mqm
檢查MQ license
license文件在安裝目錄中 /opt/mqm/lib 可以找到
amqtcert.lic - is a trial license
amqbcert.lic - is a beta license
amqpcert.lic - is the production license
——————————————————————————————————————
二、安裝新版本ibm mq
解壓,解壓文件都在MQServer中
tar –xzvf IBM_MQ_9.1.5_LINUX_X86-64.tar.gz
進入MQServer文件夾中:
cd MQServer/
運行MQ許可證程序
./mqlicense.sh
安裝WebSphere MQ for Linux服務(wù)器(Runtime、SDK 和 Server 軟件包):
rpm -U MQSeriesRuntime-9.1.5-0.x86_64.rpm
rpm -U MQSeriesSDK-9.1.5-0.x86_64.rpm
rpm -U MQSeriesServer-9.1.5-0.x86_64.rpm
安裝WebSphere MQ for Linux客戶機:
rpm -U MQSeriesClient-9.0.0-0.x86_64.rpm
安裝WebSphere MQ樣本程序:
rpm -U MQSeriesSamples-9.0.0-0.x86_64.rpm
創(chuàng)建組和用戶
安裝過程創(chuàng)建了一個名為mqm的用戶和一個同樣名為 mqm 的組。設(shè)置一個密碼來解鎖。
passwd mqm
——————————————————————————————————————
三、 配置
(這部分隊列管理器、通道、隊列等根據(jù)實際情況自行配置)
切換用戶:
su mqm
創(chuàng)建隊列管理器
使用crtmqm命令來創(chuàng)建一個名為 SXRECV
的隊列管理器。我們把它作為缺省隊列,并且將不在創(chuàng)建時指定死信隊列。然后使用strmqm命令啟動隊列管理器。
crtmqm -q ?SXRECV
strmqm ?SXRECV
——————
如果執(zhí)行crtmqm命令時提示
-bash-3.2$ crtmqm
-bash: crtmqm: command not found
find / -name crtmqm
則需要配置mqm用戶的環(huán)境變量,編輯如下文件,并添加下面的內(nèi)容,如下:
第一種方法:相對第二種較安全僅對mqm用戶有效
方法一:
(1) -bash-3.2$ vi /var/mqm/.bash_profile --有可能會在文件夾下看不到這個文件,通過編輯即可看到
PATH=$PATH:/opt/mqm/samp/bin:/opt/mqm/bin:bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
(2)執(zhí)行“.”命令,使這個文件生效
-bash-3.2$ source ?.bash_profile
(3)再次嘗試實行crtmqm或是dspmqm命令,即可發(fā)現(xiàn)已經(jīng)生效。
方法二:
( 1)
su ?root
[if !supportLists](2)[endif]
vim /etc/profile
[if !supportLists](3)[endif] 在最后面加上:
PATH=$PATH:/opt/mqm/samp/bin:/opt/mqm/bin:bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/bin
( 4)關(guān)閉遠程終端重新打開,無需重啟服務(wù)器
——————
運行隊列管理器
runmqsc SXRECV
創(chuàng)建通道和隊列
DEFINE QLOCAL (XYDATA) REPLACE USAGE (NORMAL) DEFPSIST (YES) MAXDEPTH (300000) DESCR('興業(yè)銀行')
DEFINE QLOCAL (XYTRANS) REPLACE USAGE (XMITQ) DEFPSIST (YES) MAXDEPTH (300000) DESCR('興業(yè)銀行')
DEFINE QREMOTE (XYACK) REPLACE DEFPSIST (YES) RQMNAME (SXSEND) ?RNAME (XYACK) XMITQ (XYTRANS) DESCR('XXXX')
DEFINE CHANNEL (XYDATA) CHLTYPE (RCVR) TRPTYPE (TCP) REPLACE DESCR('XXXX')
DEFINE CHANNEL (XYACK) CHLTYPE (SDR) CONNAME ('166.1.1.8(2214)') XMITQ (XYTRANS) TRPTYPE (TCP) DISCINT (0) CONVERT (NO) SHORTRTY (30) SHORTTMR (10) LONGRTY (999999999) LONGTMR (20) REPLACE DESCR('XXXX')
DEFINE CHANNEL (SVRCONN) CHLTYPE (SVRCONN) MCAUSER('mqm')
創(chuàng)建監(jiān)聽
DEFINE LISTENER (RECLISTENER) TRPTYPE (TCP) CONTROL(QMGR) PORT (2214)
啟動監(jiān)聽
start LISTENER(RECLISTENER)
啟動通道
start channel(SVRCONN)
start channel(XYDATA)
start channel(XYACK)
———————————————————————————————————————————————————
四、2035錯誤碼 說明
如果程序連接mq報錯2035,則需要對權(quán)限認證做設(shè)置,則進行以此操作
1、
ALTER QMGR CHLAUTH(DISABLED)
2、
ALTER CHL(通道名) CHLTYPE(SVRCONN) MCAUSER('mqm')
3、
ALTER AUTHINFO(SYSTEM.DEFAULT.AUTHINFO.IDPWOS) AUTHTYPE(IDPWOS) CHCKCLNT(OPTIONAL)
或者直接將連接認證選項置為空,將其完全關(guān)閉,指令如下:
ALTER QMGR CONNAUTH('')
在執(zhí)行完上述兩條命令中的任一條后,都需要刷新連接認證的緩存,指令如下:
REFRESH SECURITY TYPE(CONNAUTH)
五、mq操作命令
一、MQ的啟動與停止
1、MQ的啟動
strmqm QMgrName
如果啟動默認隊列管理器,strmqm后可以忽略隊列管理器名稱。
2、MQ的關(guān)閉
endmqm?-i?QMgrName
停止mq
二、MQ運行狀態(tài)查看與常用操作
1、 查看隊列管理器運行狀態(tài)
su mqm
執(zhí)行如下命令檢查隊列管理器運行狀態(tài):dspmq顯示結(jié)果中QMNAME表示MQ隊列管理器的名稱,STATUS表示當前運行狀態(tài)。運行狀態(tài)有如下幾種:Starting正在啟動Running正在運行Ending正在停止Ended normally已經(jīng)正常終止Ended immediately已經(jīng)立即終止Ended preemtively已經(jīng)強制終止Ended unexpectively異常終止
注意:停止MQ后必須使用dspmq命令進行狀態(tài)檢查
2、查看通道運行狀態(tài)與啟停通道
runmqsc
dis chl(*);查看所有通道定義
dis chs(*);查看所有通道狀態(tài),如果沒有查詢到通道狀態(tài),或報錯AMQ8420: Channel Status not found,請啟動通道
dis chs(ChannelName); 查看通道ChannelName的狀態(tài)
通道狀態(tài)有如下幾種:
STARTING正在啟動BINDING正在綁定INITIALIZING正在初始化RUNNING正常STOPPING?正在停止RETRYING重試PAUSED等待STOPPED已停止REQUESTING請求
start?chl(ChannelName);啟動通道
stop?chl(ChannelName);停止通道
* 重置通道
reset channel(ChannelName);?重置通道序號。當本地與其他MQ隊列管理器的通道無法正常啟動的情況,檢查日志發(fā)現(xiàn)是通道序號不一致,此時就需要先停止發(fā)送方通道,清空隊列深度并在發(fā)送方和接收方進行通道計數(shù)的重置,重置后啟動通道即可恢復(fù)通訊。
注意:重置成功mq序列號一般相同或相差1
3、查看通道監(jiān)聽狀態(tài)與啟停監(jiān)聽
runmqsc
dis listner(*);查看通道監(jiān)聽定義
dis lsstatu(listnerName);查看監(jiān)聽狀態(tài)
start?lstr(listnerName); 啟動監(jiān)聽
stop?lstr(listnerName); 停止監(jiān)聽?
4、查看隊列深度
runmqsc
dis q(*);查看所有各類隊列的屬性
dis?qlocal(QName);查看所有本地隊列的屬性
隊列深度屬性為:CURDEPTH
查看隊列深度display ql('隊列名') ?curdepth
*清空隊列深度
清空隊列深度
clear ql(‘隊列名’)
三、MQ發(fā)送和接收消息
su mqm
發(fā)送消息
amqsput ?隊列名 ?隊列管理器
獲取消息
amqsget ?隊列名 ?隊列管理器
可通過配合查看隊列深度命令,完成mq的聯(lián)調(diào)
六、其他維護中常用linux命令
1、測試端口連接
telnet ip port
2、查看已啟動的端口
netstat -an | grep 端口號
3、查看應(yīng)用進程
ps -ef |grep java
4、修改權(quán)限
chomd ?XXX(對應(yīng)的權(quán)限) ?文件目錄
5、修改文件或目錄下所有文件所有者和組
Chomd -R 用戶名:組名 ?文件目錄
6、查看目錄內(nèi)容
ls 或者ls -l (簡寫ll)
7、查看文件輸出
cat 目錄/文件名
或者
Vi 目錄/文件名 按i可進入編輯
按 G 到文檔末尾
按 gg 到文件首行
不保存退出
Esc ??:q!
保存退出
Esc ??:wq
vi 進入文檔文檔后查找關(guān)鍵字
Esc 進入命令行
/關(guān)鍵字
按n向下繼續(xù)查找
按N向上繼續(xù)查找
8、殺進程
Kill -9 進程號
9、復(fù)制
cp -r 源目錄 ?目標目錄
10、移動
mv ?-i 源文件或目錄 目標文件或目錄
11、刪除
rm -R 文件目錄
12、 切換工作目錄
cd ?相對路徑或絕對路徑
~也表示為 home 目錄 的意思, . 則是表示目前所在的目錄, .. 則表示目前目錄位置的上一層目錄。
建議:
在Linux系統(tǒng)下,右鍵打開終端后,可以輸入"man sudo"或者"info sudo"查詢,因為使用方法實在是太多,可以摘要如下,其他可以自己查看。
NAME
sudo, sudoedit - execute a command as another user
SYNOPSIS
sudo -h | -K | -k | -L | -l | -V | -v
sudo [-bEHPS] [-p prompt] [-u username|#uid] [VAR=value]
{-i | -s | command}
sudoedit [-S] [-p prompt] [-u username|#uid] file ...
OPTIONS
sudo accepts the following command line options:
-b The -b (background) option tells sudo to run the given command in
the background. Note that if you use the -b option you cannot use
shell job control to manipulate the process.
-E The -E (preserve environment) option will override the env_reset
option in sudoers(5)). It is only available when either the
matching command has the SETENV tag or the setenv option is set in
sudoers(5).
-e The -e (edit) option indicates that, instead of running a command,
the user wishes to edit one or more files. In lieu of a command,
the string "sudoedit" is used when consulting the sudoers file. If
the user is authorized by sudoers the following steps are taken:
1. Temporary copies are made of the files to be edited with the
owner set to the invoking user.
2. The editor specified by the VISUAL or EDITOR environment vari-
ables is run to edit the temporary files. If neither VISUAL
nor EDITOR are set, the program listed in the editor sudoers
variable is used.
3. If they have been modified, the temporary files are copied back
to their original location and the temporary versions are
removed.
If the specified file does not exist, it will be created. Note
that unlike most commands run by sudo, the editor is run with the
invoking user's environment unmodified. If, for some reason, sudo
is unable to update a file with its edited version, the user will
receive a warning and the edited copy will remain in a temporary
file.
-H The -H (HOME) option sets the HOME environment variable to the
homedir of the target user (root by default) as specified in
passwd(5). By default, sudo does not modify HOME (see set_home and
always_set_home in sudoers(5)).
-h The -h (help) option causes sudo to print a usage message and exit.
-i The -i (simulate initial login) option runs the shell specified in
the passwd(5) entry of the user that the command is being run as.
The command name argument given to the shell begins with a '-' to
tell the shell to run as a login shell. sudo attempts to change to
that user's home directory before running the shell. It also ini-
tializes the environment, leaving TERM unchanged, setting HOME,
SHELL, USER, LOGNAME, and PATH, and unsetting all other environment
variables. Note that because the shell to use is determined before
the sudoers file is parsed, a runas_default setting in sudoers will
specify the user to run the shell as but will not affect which
shell is actually run.
-K The -K (sure kill) option is like -k except that it removes the
user's timestamp entirely. Like -k, this option does not require a
password.
-k The -k (kill) option to sudo invalidates the user's timestamp by
setting the time on it to the Epoch. The next time sudo is run a
password will be required. This option does not require a password
and was added to allow a user to revoke sudo permissions from a
.logout file.
-L The -L (list defaults) option will list out the parameters that may
be set in a Defaults line along with a short description for each.
This option is useful in conjunction with grep(1).
-l The -l (list) option will list out the allowed (and forbidden) com-
mands for the invoking user on the current host.
-P The -P (preserve group vector) option causes sudo to preserve the
invoking user's group vector unaltered. By default, sudo will ini-
tialize the group vector to the list of groups the target user is
in. The real and effective group IDs, however, are still set to
match the target user.
-p The -p (prompt) option allows you to override the default password
prompt and use a custom one. The following percent ('%') escapes
are supported:
%H expanded to the local hostname including the domain name (on if
the machine's hostname is fully qualified or the fqdn sudoers
option is set)
%h expanded to the local hostname without the domain name
%p expanded to the user whose password is being asked for
(respects the rootpw, targetpw and runaspw flags in sudoers)
%U expanded to the login name of the user the command will be run
as (defaults to root)
%u expanded to the invoking user's login name
%% two consecutive % characters are collapsed into a single %
character
-S The -S (stdin) option causes sudo to read the password from the
standard input instead of the terminal device.
-s The -s (shell) option runs the shell specified by the SHELL envi-
ronment variable if it is set or the shell as specified in
passwd(5).
-u The -u (user) option causes sudo to run the specified command as a
user other than root. To specify a uid instead of a username, use
#uid. When running commands as a uid, many shells require that the
'#' be escaped with a backslash ('\'). Note that if the targetpw
Defaults option is set (see sudoers(5)) it is not possible to run
commands with a uid not listed in the password database.
-V The -V (version) option causes sudo to print the version number and
exit. If the invoking user is already root the -V option will
print out a list of the defaults sudo was compiled with as well as
the machine's local network addresses.
-v If given the -v (validate) option, sudo will update the user's
timestamp, prompting for the user's password if necessary. This
extends the sudo timeout for another 5 minutes (or whatever the
timeout is set to in sudoers) but does not run a command.
-- The -- flag indicates that sudo should stop processing command line
arguments. It is most useful in conjunction with the -s flag.
Environment variables to be set for the command may also be passed on
the command line in the form of VAR=value, e.g.
LD_LIBRARY_PATH=/usr/local/pkg/lib. Variables passed on the command
line are subject to the same restrictions as normal environment vari-
ables with one important exception. If the setenv option is set in
sudoers, the command to be run has the SETENV tag set or the command
matched is ALL, the user may set variables that would overwise be for-
bidden. See sudoers(5) for more information.
linux命令是對Linux系統(tǒng)進行管理的命令。對于Linux系統(tǒng)來說,無論是中央處理器、內(nèi)存、磁盤驅(qū)動器、鍵盤、鼠標,還是用戶等都是文件,Linux系統(tǒng)管理的命令是它正常運行的核心,與之前的DOS命令類似。linux命令在系統(tǒng)中有兩種類型:內(nèi)置Shell命令和Linux命令。
模式切換
1、由圖形到字符#logout或init 3。
2、由字符到圖形界面init 5。
3、退出consolelogout或exit或ctrl+d。
4、注銷Ctrl + Alt + Backspace。
5、關(guān)機#poweroff或init 0或shutdown -h now或halt -p。
6、重啟#reboot或init 6或shutdown -r now。
先不看 -o 及后面的參數(shù),命令
mount -t nfs client:/partition /partition
將 主機 `client' 下的 /partition 目錄 mount 到本機的 /partition 下,給個實例
mount -t nfs 192.168.100.1:/home/aaa /bbb
將 192.168.100.1 上的 /home/aaa 目錄mount 到本地的 /bbb 目錄。
mount -o 后面的則是用來指定文件系統(tǒng)的參數(shù),對于你的情況,就是用來指定 NFS 系統(tǒng)的參數(shù)。你只要 man nfs 就可以看到這些參數(shù)的意義了,比如
timeo=n The time in deciseconds (tenths of a second) the NFS client waits for a response before it retries an NFS request.
即訪問超時的定義,所以 timeo=14 就是設(shè)置超時為1.4秒
rsize=n The maximum number of bytes in each network READ request that the NFS client can receive when reading data from a
file on an NFS server.
即一次 READ 操作最大能讀取的數(shù)據(jù)字節(jié)數(shù),所以 rsize=8192 就是設(shè)置一次讀取最大 8k字節(jié)。
wsize=n The maximum number of bytes per network WRITE request that the NFS client can send when writing data to a file on
an NFS server.
即一次 WRITE 操作最大能寫的字節(jié)數(shù)。
intr 這個參數(shù)你可以不用理了,(根據(jù) man nfs) 從 linux 2.6.25 以后,這個參數(shù)就沒有意義了。
名稱:sudo
使用權(quán)限:在 /etc/sudoers 中有出現(xiàn)的使用者
使用方式:sudo -V
sudo -h
sudo -l
sudo -v
sudo -k
sudo -s
sudo -H
sudo [ -b ] [ -p prompt ] [ -u username/#uid] -s
sudo command
說明:以系統(tǒng)管理者的身份執(zhí)行指令,也就是說,經(jīng)由 sudo 所執(zhí)行的指令就好像是 root 親自執(zhí)行
參數(shù):
-V 顯示版本編號
-h 會顯示版本編號及指令的使用方式說明
-l 顯示出自己(執(zhí)行 sudo 的使用者)的權(quán)限
-v 因為 sudo 在第一次執(zhí)行時或是在 N 分鐘內(nèi)沒有執(zhí)行(N 預(yù)設(shè)為五)會問密碼,這個參數(shù)是重新做一次確認,如果超過 N 分鐘,也會問密碼
-k 將會強迫使用者在下一次執(zhí)行 sudo 時問密碼(不論有沒有超過 N 分鐘)
-b 將要執(zhí)行的指令放在背景執(zhí)行
-p prompt 可以更改問密碼的提示語,其中 %u 會代換為使用者的帳號名稱, %h 會顯示主機名稱
-u username/#uid 不加此參數(shù),代表要以 root 的身份執(zhí)行指令,而加了此參數(shù),可以以 username 的身份執(zhí)行指令(#uid 為該 username 的使用者號碼)
-s 執(zhí)行環(huán)境變數(shù)中的 SHELL 所指定的 shell ,或是 /etc/passwd 里所指定的 shell
-H 將環(huán)境變數(shù)中的 HOME (家目錄)指定為要變更身份的使用者家目錄(如不加 -u 參數(shù)就是系統(tǒng)管理者 root )
command 要以系統(tǒng)管理者身份(或以 -u 更改為其他人)執(zhí)行的指令
范例:
sudo -l 列出目前的權(quán)限
sudo -V 列出 sudo 的版本資訊
本文題目:關(guān)于linux命令ti的信息
URL地址:http://chinadenli.net/article14/dsgdgge.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供動態(tài)網(wǎng)站、建站公司、虛擬主機、網(wǎng)站改版、網(wǎng)站設(shè)計公司、關(guān)鍵詞優(yōu)化
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)