Linux /usr/bin与/usr/local/bin /var /bin /sbin区别

首先注意usr 指 Unix System Resource,而不是User

然后通常:

/usr/bin下面的都是系统预装的可执行程序,会随着系统升级而改变。

/usr/local/bin目录是给用户放置自己的可执行程序的地方,推荐放在这里,不会被系统升级而覆盖同名文件。

如果两个目录下有相同的可执行程序,谁优先执行受到PATH环境变量的影响,比如我的一台服务器的PATH变量为。

echo $PATH

/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/dean/bin

这里/usr/local/bin优先于/usr/bin, 一般都是如此。

/var目录下一般为所有服务的登录的文件或错误信息文件与一些数据库等。

例如:/var/log/boot.log 为系统引导文件;/var/log/messages 为系统报错日志; /var/log/maillog 为邮箱系统日志。

/bin是系统的一些指令。bin为binary的简写主要放置一些系统的必备执行档例如:cat、cp、chmod df、dmesg、gzip、kill、ls、mkdir、more、mount、rm、su、tar等。

    /sbin一般是指超级用户指令主要放置一些系统管理的必备程式例如:cfdisk、dhcpcd、dump、e2fsck、fdisk、halt、ifconfig、ifup、 ifdown、init、insmod、lilo、lsmod、mke2fs、modprobe、quotacheck、reboot、rmmod、 runlevel、shutdown等。

    /usr/bin是你在后期安装的一些软件的运行脚本。主要放置一些应用软体工具的必备执行档例如c++、g++、gcc、chdrv、diff、dig、du、eject、elm、free、gnome*、 gzip、htpasswd、kfm、ktop、last、less、locale、m4、make、man、mcopy、ncftp、 newaliases、nslookup passwd、quota、smb*、wget等。

Debian(树莓派)开机启动脚本设置

为了更好的理解启动脚本的设置,我们需要先了解下Debian系统中的运行级别。

  • 0 – 停机(千万不要把initdefault设置为0 )
  • 1 – 单用户模式(单用户模式,只允许root用户对系统进行维护。)
  • 2 – 多用户,但是没有NFS
  • 3 – 完全多用户模式(字符界面)
  • 4 – 基本不用
  • 5 – X11(图形界面)
  • 6 – 重新启动(千万不要把initdefault设置为6 )

查看当前系统的运行级别

runlevel

/etc/rcN.d目录

通常系统启动后先执行/etc/rcS.d/目录下的脚本,然后根据运行级别,执行对应/etc/rcN.d/目录下的脚本(N为系统运行级别)。

下面是/etc/rc5.d目录下的内容

lrwxrwxrwx 1 root root  24 Dec 30 15:56 K02gmediarenderer -> ../init.d/gmediarenderer

lrwxrwxrwx 1 root root  16 Jan 24 23:52 K02mopidy -> ../init.d/mopidy

lrwxrwxrwx 1 root root  18 Jan 24 23:55 K02upmpdcli -> ../init.d/upmpdcli

-rw-r–r– 1 root root 677 Apr  7  2015 README

lrwxrwxrwx 1 root root  18 Sep 24 21:21 S01bootlogs -> ../init.d/bootlogs

lrwxrwxrwx 1 root root  16 Sep 24 22:33 S01dhcpcd -> ../init.d/dhcpcd

lrwxrwxrwx 1 root root  17 Oct 21 13:27 S01hd-idle -> ../init.d/hd-idle

lrwxrwxrwx 1 root root  17 Sep 24 21:33 S01ifplugd -> ../init.d/ifplugd

lrwxrwxrwx 1 root root  14 Jan 14 14:37 S02dbus -> ../init.d/dbus

lrwxrwxrwx 1 root root  21 Mar  3 16:04 S02ddns-dnspod -> ../init.d/ddns-dnspod

我们可以看到有K和S开头的文件,K代表关闭,S代表启动,后面紧跟的数字代表启动顺序,数字越大启动或关闭就越靠后。目录下的每一个文件都指向了/etc/init.d目录中的文件,开机启动脚本就是放在这个目录下的。

文件中代表启动顺序的数字是根据依赖关系自动设置的,在新版的update-rc.d命令中无法手动设置这个数字。查看是否可以手动设置参看man update-rc.d说明。

添加新的启动脚本

在/etc/init.d目录下新建一个文件,并添加执行权限sudo chmod a+x xxx_script。

#!/bin/sh

### BEGIN INIT INFO

# Provides:          ddns-dnspod

# Required-Start:    $local_fs $remote_fs $network $syslog

# Required-Stop:     $local_fs $remote_fs $network $syslog

# Default-Start:     2 3 4 5

# Default-Stop:      0 1 6

# Short-Description: starts the ddns-dnspod service

# Description:       starts the ddns-dnspod service

### END INIT INFO

case “$1” in

start)

echo “start ddns-dnspod”

sudo /home/pi/work/projects/dnspod_ddns/dnspod_ddns.py -d start

;;

stop)

sudo /home/pi/work/projects/dnspod_ddns/dnspod_ddns.py -d stop

;;

restart)

sudo /home/pi/work/projects/dnspod_ddns/dnspod_ddns.py -d restart

;;

*)

echo “Usage: $0 (start|stop)”

;;

esac

exit 0

上面是一个ddns的开机启动脚本。我们需要在启动脚本的注释中写明启动依赖和在那些运行级别启动。具体的依赖名写法可以参考这里

当在/etc/init.d目录下添加新的启动脚本后,我们最好先进行下测试,执行下各种选项确保正常运行。

/etc/init.d/xxx_script start

/etc/init.d/xxx_script stop

以git用户运行,后台运行

su – git -c nohup -c /home/git/gitea-1.7-linux-arm-7 web &

update-rc.d命令

在/etc/init.d目录下添加启动脚本后,我们需要使用update-rc.d命令设置脚本开机启动。

update-rc.d xxx_script defaults

执行完上面命令后,查看/etc/rcN.d目录中是否有指向xxx_script文件的启动和关闭文件。另外还会向/run/systemd/generator.late/目录添加一个service,这样我们就可以使用sudo service xxx_script start|stop命令来控制脚本运行。

update-rc.d其他参数用法

# 移除开机启动连接(/etc/rcN.d 目录下的文件)

sudo update-rc.d xxx_script remove

# 启用或者禁用开机启动

sudo update-rc.d xxx_script enable|disable

Centos 用户管理

一.组管理

1.       添加用户组

groupadd

2.       删除用户组

groupdel

3.       修改用户组

groupmod

4.       切换用户组

newgrp <groupname>

如果一个用户同时属于多个用户组,可以用 newgrp 命令切换至目的组,以便能够拥有该组的权限。

5.       查看所有组

所有组其实就是 /etc/group 文件的内容做一些过滤。

cat /etc/group | awk -F: ‘{print $1}’

6.       查看用户所在组

groups <username>

二.用户管理

1. 添加用户

useradd <username> -d <path> -m -g –G –p

常用的就是上面几个参数,意思分别为:

-d :指定用户主目录。如果此目录不存在,同时使用 -m 就会创建此目录。

-m :创建用户主目录

-g :用户所属组 ID

-G :用户所属组名

-p :登录密码。注意这个登录密码不是明文,是指加密后的密码。

e.g.

useradd testuser –m –G mygroup

将会创建一个 testuser 的用户,并自动创建 /home/testuser 的用户主目录,并将用户添加至 mygroup 组中。

2. 删除用户

userdel –f –r <username>

-r :删除用户主目录以及邮箱中的邮件

-f :强行删除文件,即使属主不是该用户

3. 修改用户

usermod <username> -d <path> -m -g –G –p

参数意思与 useradd 大致相同

4. 用户密码

passwd <username>        :修改密码

passwd –d <username> :命令将用户的密码删除,即下次登录无须密码。

passwd –l <username>   :锁定用户,使其无法登录

三.文件属主管理

1. 更改属主

chown –R <username>.<groupname> file

-R :表示递归更改

e.g.

chown –R testuser.newgroup testpath

上面的命令将 testpath 路径下的所有文件的拥有者都改为 testuser ,拥有组都改为 newgroup 。

2. 设置文件掩码

umask [a1 a2 a3 ]

用户可以使用 umask 命令设置文件默认的生成掩码。默认的生成掩码告诉系统创建一个文件或目录不应该赋予哪些权限。如果用户将 umask 命令放在环境文件 .bash_profile 中,就可以控制所有新建的文件和目录的访问权限。

a1 表示的是不允许属主的权限, a2 表示的是不允许同组人的权限, a3 代表不允许其他人的权限。

umask 022        :   表示设置不允许同组用户和其他用户有写的权限。

umask              :   显示当前的默认生成掩码。

添加用户

useradd

-d /home/levi levi

passwd

levi

usermod

-s /sbin/bash levi

usermod

-d /home/levi levi

赋予SSH权限

vi

/etc/ssh/sshd_config

添加

AllowUsers:levi

登录SSH提示没有权限

ssh levi@121.199.10.190
levi@121.199.10.190’s password: Permission denied, please try again.

重新设置一下密码

passwd username

linux zip unzip 压缩解压

linux zip 命令详解  

功能说明:压缩文件。  

语 法:zip [-AcdDfFghjJKlLmoqrSTuvVwXyz$][-b <工作目录>][-ll][-n <字尾字符串>][-t <日期时间>][-<压缩效率>][压缩文件][文件…][-i <范本样式>][-x <范本样式>]  

补充说明:zip是个使用广泛的压缩程序,文件经它压缩后会另外产生具有”.zip”扩展名的压缩文件。  

参 数:  

-A 调整可执行的自动解压缩文件。  

-b<工作目录> 指定暂时存放文件的目录。  

-c 替每个被压缩的文件加上注释。  

-d 从压缩文件内删除指定的文件。  

-D 压缩文件内不建立目录名称。  

-f 此参数的效果和指定”-u”参数类似,但不仅更新既有文件,如果某些文件原本不存在于压缩文件内,使用本参数会一并将其加入压缩文件中。  

-F 尝试修复已损坏的压缩文件。  

-g 将文件压缩后附加在既有的压缩文件之后,而非另行建立新的压缩文件。  

-h 在线帮助。  

-i<范本样式> 只压缩符合条件的文件。  

-j 只保存文件名称及其内容,而不存放任何目录名称。  

-J 删除压缩文件前面不必要的数据。  

-k 使用MS-DOS兼容格式的文件名称。  

-l 压缩文件时,把LF字符置换成LF+CR字符。  

-ll 压缩文件时,把LF+CR字符置换成LF字符。  

-L 显示版权信息。  

-m 将文件压缩并加入压缩文件后,删除原始文件,即把文件移到压缩文件中。  

-n<字尾字符串> 不压缩具有特定字尾字符串的文件。  

-o 以压缩文件内拥有最新更改时间的文件为准,将压缩文件的更改时间设成和该文件相同。  

-q 不显示指令执行过程。  

-r 递归处理,将指定目录下的所有文件和子目录一并处理。  

-S 包含系统和隐藏文件。  

-t<日期时间> 把压缩文件的日期设成指定的日期。  

-T 检查备份文件内的每个文件是否正确无误。  

-u 更换较新的文件到压缩文件内。  

-v 显示指令执行过程或显示版本信息。  

-V 保存VMS操作系统的文件属性。  

-w 在文件名称里假如版本编号,本参数仅在VMS操作系统下有效。  

-x<范本样式> 压缩时排除符合条件的文件。  

-X 不保存额外的文件属性。  

-y 直接保存符号连接,而非该连接所指向的文件,本参数仅在UNIX之类的系统下有效。  

-z 替压缩文件加上注释。  

-$ 保存第一个被压缩文件所在磁盘的卷册名称。  

-<压缩效率> 压缩效率是一个介于1-9的数值。

linux unzip 命令详解

功能说明:解压缩zip文件

语 法:unzip [-cflptuvz][-agCjLMnoqsVX][-P <密码>][.zip文件][文件][-d <目录>][-x <文件>] 或 unzip [-Z]

补充说明:unzip为.zip压缩文件的解压缩程序。

参 数:

-c 将解压缩的结果显示到屏幕上,并对字符做适当的转换。

-f 更新现有的文件。

-l 显示压缩文件内所包含的文件。

-p 与-c参数类似,会将解压缩的结果显示到屏幕上,但不会执行任何的转换。

-t 检查压缩文件是否正确。

-u 与-f参数类似,但是除了更新现有的文件外,也会将压缩文件中的其他文件解压缩到目录中。

-v 执行是时显示详细的信息。

-z 仅显示压缩文件的备注文字。

-a 对文本文件进行必要的字符转换。

-b 不要对文本文件进行字符转换。

-C 压缩文件中的文件名称区分大小写。

-j 不处理压缩文件中原有的目录路径。

-L 将压缩文件中的全部文件名改为小写。

-M 将输出结果送到more程序处理。

-n 解压缩时不要覆盖原有的文件。

-o 不必先询问用户,unzip执行后覆盖原有文件。

-P<密码> 使用zip的密码选项。

-q 执行时不显示任何信息。

-s 将文件名中的空白字符转换为底线字符。

-V 保留VMS的文件版本信息。

-X 解压缩时同时回存文件原来的UID/GID。

[.zip文件] 指定.zip压缩文件。

[文件] 指定要处理.zip压缩文件中的哪些文件。

-d<目录> 指定文件解压缩后所要存储的目录。

-x<文件> 指定不要处理.zip压缩文件中的哪些文件。

-Z unzip -Z等于执行zipinfo指令

范例:

zip命令可以用来将文件压缩成为常用的zip格式。unzip命令则用来解压缩zip文件。

1. 我想把一个文件abc.txt和一个目录dir1压缩成为yasuo.zip:

# zip -r yasuo.zip abc.txt dir1

2.我下载了一个yasuo.zip文件,想解压缩:

# unzip yasuo.zip

3.我当前目录下有abc1.zip,abc2.zip和abc3.zip,我想一起解压缩它们:

# unzip abc\?.zip

注释:?表示一个字符,如果用*表示任意多个字符。

4.我有一个很大的压缩文件large.zip,我不想解压缩,只想看看它里面有什么:

# unzip -v large.zip

5.我下载了一个压缩文件large.zip,想验证一下这个压缩文件是否下载完全了

# unzip -t large.zip

6.我用-v选项发现music.zip压缩文件里面有很多目录和子目录,并且子目录中其实都是歌曲mp3文件,我想把这些文件都下载到第一级目录,而不是一层一层建目录:

# unzip -j music.zip

CentOS 7 firewalld 防火墙设置

// 查看防火墙状态

systemctl status firewalld

// 开启防火墙

systemctl start firewalld

// 开机启动

systemctl enable firewalld

// 开机关闭

systemctl disable firewalld

// 查询打开的端口

firewall-cmd –zone=public –list-ports

//关闭端口9002

firewall-cmd –zone=public –remove-port=9002/tcp –permanent

//重新载入一下防火墙设置,使设置生效

firewall-cmd –reload

// 允许ip172.27.0.45访问9002端口

firewall-cmd –permanent –add-rich-rule=”rule family=”ipv4″ source address=”172.27.0.45″ port protocol=”tcp” port=”9002″ accept”

//重新载入一下防火墙设置,使设置生效

firewall-cmd –reload

//查看已设置规则

firewall-cmd –zone=public –list-rich-rules

查看

firewall-cmd –zone= public –query-port=80/tcp

删除

firewall-cmd –zone= public –remove-port=80/tcp –permanent

批量开放或限制端口

批量开放端口,如从9002到9005这之间的端口我们全部要打开

firewall-cmd –zone=public –add-port=9002-9005/tcp –permanent

firewall-cmd –reload

批量限制端口为

firewall-cmd –zone=public –remove-port=9002-9005/tcp –permanent

firewall-cmd –reload

开放或限制ip(设置规则)

开放IP为172.27.0.0的地址允许访问9002端口

firewall-cmd –permanent –add-rich-rule=“rule family=“ipv4” source address=“172.27.0.0” port protocol=“tcp” port=“9002” accept”

限制IP为172.27.0.0的地址禁止访问9002端口即禁止访问机器

firewall-cmd –permanent –add-rich-rule=“rule family=“ipv4” source address=“172.27.0.0” port protocol=“tcp” port=“9002” reject”

删除已设置规则

firewall-cmd –permanent –remove-rich-rule=“rule family=“ipv4” source address=” 192.168.0.0″ port protocol=“tcp” port=“9001” accept”

查看端口开放情况

firewall-cmd –list-all

firewall-cmd –zone= public –query-port=80/tcp

Linux 手工配置jdk tomcat

本例jdk、tomcat的位置

/usr/local/java/jdk1.7.0_79

/usr/local/tomcat/apache-tomcat-7.0.92

注意:/usr/目录所有用户都有访问权限的root目录默认不允许其他用户访问,方便起见jdk和tomcat放置在/usr目录下

两种配置方式:1、配置环境变量,2、tomcat单独配置

1、配置环境变量

JAVA_HOME=/usr/local/java/jdk1.7.0_79

JAVA_BIN=/usr/local/java/jdk1.7.0_79/bin

PATH=$PATH:$JAVA_BIN

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

export JAVA_HOME JAVA_BIN PATH CLASSPATH

Source  /etc/profile

2、单独配置jdk 

在tomcat bin下找到setclasspath.sh,在文件的最开始加入如下代码:

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

export JRE_HOME=/usr/local/java/jdk1.7.0_79/jre

Linux Centos  安装 weblogic

一、安装前准备工作:

1、创建用户useradd weblogic;创建用户成功linux系统会自动创建一个和用户名相同的分组,并将该用户分到改组中。并会在/home路径下创建一个和用户名相同的路径,比如我们创建的weblogic。

注:当然,你也可以通过groupadd -g GID groupname(GID代表创建组的ID,一般大于500),然后useradd –d userhome –g GID username(userhome 代表用户的主目录,GID 为前一步创建的组ID)创建用户并将用户分到相应的组里面。

2、卸载掉linux系统自带的jdk,安装我们自己的jdk,建议和开发过程中用到的jdk版本一致。

注:jdk的卸载和安装参见:http://www.linuxidc.com/Linux/2016-12/138043.htm。

二、开始安装:

a.?创建weblogic用户组.?

useradd weblogic

passwd weblogic

更改jdk版本

2、进入安装目录

#cd /home

#cp jdk-7u76-linux-x64.rpm /usr/local

#cd /usr/local

给所有用户添加可执行的权限

#rpm -ivh jdk-7u76-linux-x64.rpm

设置环境变量

#vi /etc/profile

打开后,在文档最下方加上以下环境变量配置代码:

export JAVA_HOME=/usr/java/jdk1.6.0_45

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

export PATH=$JAVA_HOME/bin:$PATH

执行生效

#. /etc/profile

weblogic用户

export JAVA_HOME=/usr/java/jdk1.6.0_45

export JAVA_BIN=/usr/java/jdk1.6.0_45/bin

export PATH=$PATH:$JAVA_HOME/bin

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

export JAVA_HOME JAVA_BIN PATH CLASSPATH

注意:export PATH=$JAVA_HOME/bin:$PATH,注意将$PATH放到最后。以免造成新旧版本问题。

当你已经成功把jdk1.6.0_45 安装到 /usr/java,并且配置好了系统环境变量

执行 # java -version 时就是 显示jdk1.6.0_45,是因为你的linux系统有默认的jdk;执行

cp jdk-6u7-linux-i586.bin /usr

即将jdk复制到/usr目录下,然后进入/usr目录cd /usr

执行权限

chmod +x jdk-6u45-linux-x64.bin

执行安装命令

./jdk-6u45-linux-x64.bin

1、# cd /usr/bin

# ln -s -f /usr/java/jdk1.6.0_45/jre/bin/java

# ln -s -f /usr/java/jdk1.6.0_45/bin/javac

2、接着卸载jdk-1.7.0_76,再次重新安装。卸载方法:

先查看jdk-1.7.0_76包名

#rpm -qa | grep jdk

接着执行

#rpm -e jdk-1.7.0_76-fcs

卸载完后,再次重新安装jdk-7u76-linux-x64.rpm 。

1、进入安装路径:/home/weblogic

2、将安装文件wls1036_generic.jar放入安装目录

3、chmod a+x wls1036_generic.jar  赋予安装文件可执行的权限

4、执行安装命令:java -jar filename.jar -mode=console

注:如果安装文件是.bin格式的文件,安装命令为:./wls1036_generic.bin -mode=console;(你可以不加“-mode=console”的控制台文本模式,因为在你安装时无法启动图形安装界面时它会自动的进入文本控制台模式的)

5、控制台安装:

一、安装weblogic10.3.6 64位:

-bash-4.1$ java -jar wls1036_generic.jar

Unable to instantiate GUI, defaulting to console mode.无法实例化 GUI,默认进入控制台模式。

Extracting 0%……………………………………………………………………………………….100%

<——————– Oracle Installer – WebLogic 10.3.6.0 ——————->

Welcome:

——–

This installer will guide you through the installation of WebLogic 10.3.6.0.

Type “Next” or enter to proceed to the next prompt.  If you want to change data entered previously, type “Previous”.  You may quit the installer at any time by typing “Exit”.

Enter [Exit][Next]> 回车

<——————– Oracle Installer – WebLogic 10.3.6.0 ——————->

Choose Middleware Home Directory:

———————————

    “Middleware Home” = [Enter new value or use default

“/bea/weblogic/Oracle/Middleware”]

Enter new Middleware Home OR [Exit][Previous][Next]> /bea/weblogic/

<——————– Oracle Installer – WebLogic 10.3.6.0 ——————->

Choose Middleware Home Directory:

———————————

    “Middleware Home” = [/bea/weblogic]

Use above value or select another option:

    1 – Enter new Middleware Home

    2 – Change to default [/bea/weblogic/Oracle/Middleware]

Enter option number to select OR [Exit][Previous][Next]> 1

<——————– Oracle Installer – WebLogic 10.3.6.0 ——————->

Choose Middleware Home Directory:

———————————

    “Middleware Home” = [/bea/weblogic]

Enter new Middleware Home OR [Exit][Previous][Next]>

<——————– Oracle Installer – WebLogic 10.3.6.0 ——————->

Choose Middleware Home Directory:

———————————

    Warning

/bea/weblogic directory is not empty. Proceed with installation?

Enter [Exit][Previous][Next]>

<——————– Oracle Installer – WebLogic 10.3.6.0 ——————->

Register for Security Updates:

——————————

Provide your email address for security updates and  to initiate configuration manager.

  1|Email:[]

  2|Support Password:[]

  3|Receive Security Update:[Yes]

Enter index number to select OR [Exit][Previous][Next]> 3

<——————– Oracle Installer – WebLogic 10.3.6.0 ——————->

Register for Security Updates:

——————————

Provide your email address for security updates and  to initiate configuration manager.

    “Receive Security Update:” = [Enter new value or use default “Yes”]

Enter [Yes][No]? no

<——————– Oracle Installer – WebLogic 10.3.6.0 ——————->

Register for Security Updates:

——————————

Provide your email address for security updates and  to initiate configuration manager.

    “Receive Security Update:” = [Enter new value or use default “Yes”]

Enter [Yes][No]? yes

<——————– Oracle Installer – WebLogic 10.3.6.0 ——————->

Register for Security Updates:

——————————

Provide your email address for security updates and  to initiate configuration manager.

  1|Email:[]

  2|Support Password:[]

  3|Receive Security Update:[No]

Enter index number to select OR [Exit][Previous][Next]>

<——————– Oracle Installer – WebLogic 10.3.6.0 ——————->

Register for Security Updates:

——————————

Provide your email address for security updates and  to initiate configuration manager.

  1|Email:[]

  2|Support Password:[]

  3|Receive Security Update:[No]

Enter index number to select OR [Exit][Previous][Next]>

<——————– Oracle Installer – WebLogic 10.3.6.0 ——————->

Choose Install Type:

——————–

Select the type of installation you wish to perform.

 ->1|Typical

    |  Install the following product(s) and component(s):

    | – WebLogic Server

    | – Oracle Coherence

  2|Custom

    |  Choose software products and components to install and perform optional

    |configuration.

Enter index number to select OR [Exit][Previous][Next]> 2

<——————– Oracle Installer – WebLogic 10.3.6.0 ——————->

Choose Products and Components:

——————————-

    Release 10.3.6.0

    |_____WebLogic Server [1] x

    |    |_____Core Application Server [1.1] x

    |    |_____Administration Console [1.2] x

    |    |_____Configuration Wizard and Upgrade Framework [1.3] x

    |    |_____Web 2.0 HTTP Pub-Sub Server [1.4] x

    |    |_____WebLogic SCA [1.5] x

    |    |_____WebLogic JDBC Drivers [1.6] x

    |    |_____Third Party JDBC Drivers [1.7] x

    |    |_____WebLogic Server Clients [1.8] x

    |    |_____WebLogic Web Server Plugins [1.9] x

    |    |_____UDDI and Xquery Support [1.10] x

    |    |_____Server Examples [1.11]

    |    |_____Evaluation Database [1.12] x

    |_____Oracle Coherence [2] x

        |_____Coherence Product Files [2.1] x

        |_____Coherence Examples [2.2]

    *Estimated size of installation: 690.2 MB

Enter number exactly as it appears in brackets to toggle selection OR [Exit][Previous][Next]> 2

<——————– Oracle Installer – WebLogic 10.3.6.0 ——————->

Choose Products and Components:

——————————-

    Release 10.3.6.0

    |_____WebLogic Server [1] x

    |    |_____Core Application Server [1.1] x

    |    |_____Administration Console [1.2] x

    |    |_____Configuration Wizard and Upgrade Framework [1.3] x

    |    |_____Web 2.0 HTTP Pub-Sub Server [1.4] x

    |    |_____WebLogic SCA [1.5] x

    |    |_____WebLogic JDBC Drivers [1.6] x

    |    |_____Third Party JDBC Drivers [1.7] x

    |    |_____WebLogic Server Clients [1.8] x

    |    |_____WebLogic Web Server Plugins [1.9] x

    |    |_____UDDI and Xquery Support [1.10] x

    |    |_____Server Examples [1.11]

    |    |_____Evaluation Database [1.12] x

    |_____Oracle Coherence [2]

        |_____Coherence Product Files [2.1]

        |_____Coherence Examples [2.2]

    *Estimated size of installation: 678.7 MB

Enter number exactly as it appears in brackets to toggle selection OR [Exit][Previous][Next]>

<——————– Oracle Installer – WebLogic 10.3.6.0 ——————->

JDK Selection (Any * indicates Oracle Supplied VM):

—————————————————

JDK(s) chosen will be installed.  Defaults will be used in script string-substitution if installed.

  1|Add Local Jdk

  2|/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64[x]

  *Estimated size of installation:  678.7 MB

Enter 1 to add or >= 2 to toggle selection  OR [Exit][Previous][Next]>

<——————– Oracle Installer – WebLogic 10.3.6.0 ——————->

Choose Product Installation Directories:

—————————————-

Middleware Home Directory: [/bea/weblogic]

Product Installation Directories:

    “WebLogic Server” = [Enter new value or use default

“/bea/weblogic/wlserver_10.3”]

Enter new WebLogic Server OR [Exit][Previous][Next]>

<——————– Oracle Installer – WebLogic 10.3.6.0 ——————->

The following Products and JDKs will be installed:

————————————————–

    WebLogic Platform 10.3.6.0

    |_____WebLogic Server

        |_____Core Application Server

        |_____Administration Console

        |_____Configuration Wizard and Upgrade Framework

        |_____Web 2.0 HTTP Pub-Sub Server

        |_____WebLogic SCA

        |_____WebLogic JDBC Drivers

        |_____Third Party JDBC Drivers

        |_____WebLogic Server Clients

        |_____WebLogic Web Server Plugins

        |_____UDDI and Xquery Support

        |_____Evaluation Database

    *Estimated size of installation: 678.8 MB

Enter [Exit][Previous][Next]>

<——————– Oracle Installer – WebLogic 10.3.6.0 ——————->

Installing files..

0%          25%          50%          75%          100%

[————|————|————|————]

[***************************************************]

Performing String Substitutions…

<——————– Oracle Installer – WebLogic 10.3.6.0 ——————->

Configuring OCM…

0%          25%          50%          75%          100%

[————|————|————|————]

[***************************************************]

Creating Domains…

<——————– Oracle Installer – WebLogic 10.3.6.0 ——————->

Installation Complete

Congratulations! Installation is complete.

Press [Enter] to continue or type [Exit]>

<——————– Oracle Installer – WebLogic 10.3.6.0 ——————->

Clean up process in progress …

二、配置domains

cd /home/weblogic/Oracle/Middleware/wlserver_10.3/common/bin

-bash-4.1$ ./config.sh

Unable to instantiate GUI, defaulting to console mode.

<——————- Fusion Middleware Configuration Wizard ——————>

Welcome:

——–

Choose between creating and extending a domain. Based on your selection,

the Configuration Wizard guides you through the steps to generate a new or

extend an existing domain.

 ->1|Create a new WebLogic domain

    |    Create a WebLogic domain in your projects directory.

  2|Extend an existing WebLogic domain

    |    Use this option to add new components to an existing domain and modify    |configuration settings.

Enter index number to select OR [Exit][Next]> 1

<——————- Fusion Middleware Configuration Wizard ——————>

Select Domain Source:

———————

Select the source from which the domain will be created. You can create the

domain by selecting from the required components or by selecting from a

list of existing domain templates.

 ->1|Choose Weblogic Platform components

    |    You can choose the Weblogic component(s) that you want supported in

    |your domain.

  2|Choose custom template

    |    Choose this option if you want to use an existing  template. This

    |could be a custom created template using the Template Builder.

Enter index number to select OR [Exit][Previous][Next]> 1

<——————- Fusion Middleware Configuration Wizard ——————>

Application Template Selection:

——————————-

    Available Templates

    |_____Basic WebLogic Server Domain – 10.3.6.0 [wlserver_10.3]x

    |_____Basic WebLogic SIP Server Domain – 10.3.6.0 [wlserver_10.3] [2]

    |_____WebLogic Advanced Web Services for JAX-RPC Extension – 10.3.6.0 [wlserver_10.3] [3]

    |_____WebLogic Advanced Web Services for JAX-WS Extension – 10.3.6.0 [wlserver_10.3] [4]

Enter number exactly as it appears in brackets to toggle selection OR [Exit][Previous][Next]>

<——————- Fusion Middleware Configuration Wizard ——————>

Edit Domain Information:

————————

    |  Name  |    Value    |

  _|________|_____________|

  1| *Name: | base_domain |

Enter value for “Name” OR [Exit][Previous][Next]> wlyxweb

<——————- Fusion Middleware Configuration Wizard ——————>

Edit Domain Information:

————————

    |  Name  |  Value  |

  _|________|_________|

  1| *Name: | wlyxweb |

Use above value or select another option:

    1 – Modify “Name”

    2 – Discard Changes

Enter option number to select OR [Exit][Previous][Next]>

<——————- Fusion Middleware Configuration Wizard ——————>

Select the target domain directory for this domain:

—————————————————

    “Target Location” = [Enter new value or use default

“/bea/weblogic/user_projects/domains”]

Enter new Target Location OR [Exit][Previous][Next]> /wlyx/webapp/domains

<——————- Fusion Middleware Configuration Wizard ——————>

Configure Administrator User Name and Password:

———————————————–

Create a user to be assigned to the Administrator role. This user is the

default administrator used to start development mode servers.

    |          Name          |                  Value                  |

  _|_________________________|_________________________________________|

  1|        *Name:          |                weblogic                |

  2|    *User password:    |                                        |

  3| *Confirm user password: |                                        |

  4|      Description:      | This user is the default administrator. |

Use above value or select another option:

    1 – Modify “Name”

    2 – Modify “User password”

    3 – Modify “Confirm user password”

    4 – Modify “Description”

Enter option number to select OR [Exit][Previous][Next]> 2

<——————- Fusion Middleware Configuration Wizard ——————>

Configure Administrator User Name and Password:

———————————————–

Create a user to be assigned to the Administrator role. This user is the

default administrator used to start development mode servers.

    “*User password:” = []

Enter new *User password: OR [Exit][Reset][Accept]> welwlyx50

<——————- Fusion Middleware Configuration Wizard ——————>

Configure Administrator User Name and Password:

———————————————–

Create a user to be assigned to the Administrator role. This user is the

default administrator used to start development mode servers.

    |          Name          |                  Value                  |

  _|_________________________|_________________________________________|

  1|        *Name:          |                weblogic                |

  2|    *User password:    |                *********                |

  3| *Confirm user password: |                                        |

  4|      Description:      | This user is the default administrator. |

Use above value or select another option:

    1 – Modify “Name”

    2 – Modify “User password”

    3 – Modify “Confirm user password”

    4 – Modify “Description”

    5 – Discard Changes

Enter option number to select OR [Exit][Previous][Next]> 3

<——————- Fusion Middleware Configuration Wizard ——————>

Configure Administrator User Name and Password:

———————————————–

Create a user to be assigned to the Administrator role. This user is the

default administrator used to start development mode servers.

    “*Confirm user password:” = []

Enter new *Confirm user password: OR [Exit][Reset][Accept]> welwlyx50

<——————- Fusion Middleware Configuration Wizard ——————>

Configure Administrator User Name and Password:

———————————————–

Create a user to be assigned to the Administrator role. This user is the

default administrator used to start development mode servers.

    |          Name          |                  Value                  |

  _|_________________________|_________________________________________|

  1|        *Name:          |                weblogic                |

  2|    *User password:    |                *********                |

  3| *Confirm user password: |                *********                |

  4|      Description:      | This user is the default administrator. |

Use above value or select another option:

    1 – Modify “Name”

    2 – Modify “User password”

    3 – Modify “Confirm user password”

    4 – Modify “Description”

    5 – Discard Changes

Enter option number to select OR [Exit][Previous][Next]>

<——————- Fusion Middleware Configuration Wizard ——————>

Domain Mode Configuration:

————————–

Enable Development or Production Mode for this domain.

 ->1|Development Mode

  2|Production Mode

Enter index number to select OR [Exit][Previous][Next]> 2

<——————- Fusion Middleware Configuration Wizard ——————>

Java SDK Selection:

——————-

 ->1|N/A SDK 1.6.0_24 @ /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64

  2|Other Java SDK

Enter index number to select OR [Exit][Previous][Next]> 2

<——————- Fusion Middleware Configuration Wizard ——————>

Java SDK Selection:

——————-

    “JVM Directory” = []

Enter new JVM Directory OR [Exit][Previous][Next]> /bea/jdk/jdk1.6.0_37

<——————- Fusion Middleware Configuration Wizard ——————>

Java SDK Selection:

——————-

    “JVM Directory” = [/bea/jdk/jdk1.6.0_37]

Enter new JVM Directory OR [Exit][Previous][Next]>

<——————- Fusion Middleware Configuration Wizard ——————>

Select Optional Configuration:

——————————

  1|Administration Server [ ]

  2|Managed Servers, Clusters and Machines [ ]

  3|RDBMS Security Store [ ]

Enter index number to select OR [Exit][Previous][Next]> 1

<——————- Fusion Middleware Configuration Wizard ——————>

Select Optional Configuration:

——————————

  1|Administration Server [x]

  2|Managed Servers, Clusters and Machines [ ]

  3|RDBMS Security Store [ ]

Enter index number to select OR [Exit][Previous][Next]>

<——————- Fusion Middleware Configuration Wizard ——————>

Configure the Administration Server:

————————————

Each WebLogic Server domain must have one Administration Server. The

Administration Server is used to perform administrative tasks.

    |      Name      |        Value        |

  _|__________________|_____________________|

  1|      *Name:      |    AdminServer    |

  2| *Listen address: | All Local Addresses |

  3|  Listen port:  |        7001        |

  4| SSL listen port: |        N/A        |

  5|  SSL enabled:  |        false        |

Use above value or select another option:

    1 – Modify “Name”

    2 – Modify “Listen address”

    3 – Modify “Listen port”

    4 – Modify “SSL enabled”

Enter option number to select OR [Exit][Previous][Next]>

<——————- Fusion Middleware Configuration Wizard ——————>

Creating Domain…

0%          25%          50%          75%          100%

[————|————|————|————]

[***************************************************]

**** Domain Created Successfully! ****

四:weblogic的使用

1、启动服务时无需输入用户名和密码

进入到你新建的域中:cd /home/weblogic/Oracle/Middleware/user_projects/domains/base_domain/servers/AdminServer

然后在该文件夹下新建名为security的文件夹:mkdir security

在刚刚新建是文件夹中新建名为boot.properties文件:vi boot.properties

然后在该文件中输入:

username=weblogic

password=weblogc123

保存后退出。重启weblogic。此时你会发觉,weblogic再也不会提示要求你输入weblogic管理台的用户名和密码了。

重启后我们来到刚刚的新建的文件夹中查看新建的文件:

cd /home/weblogic/Oracle/Middleware/user_projects/domains/base_domain/servers/AdminServer/security

vi boot.properties发现它的内容已经变成下面这个样子了:

#Sun Aug 04 10:23:54 CST 2013

password={AES}KWRQeICbIyJLO3zh+v+/9JeJtCzpK9ge6j4pqf9sSqA\=

username={AES}ICJVfwErXU5MOQyVPzcvVpKBkK6gI6UFlwqkkEuVgBg\=

Weblogic把它给加密了,因此只有装Weblogic的那个人即System Admin才真正知道Weblogic控制台的登录信息,这样就很安全了。

2、启动weblogic服务

cd /home/weblogic/Oracle/Middleware/user_projects/domains/base_domain

./startWeblogic.sh

nohup ./startWeblogic.sh &(nohup命令:如果你正在运行一个进程,而且你觉得在退出帐户时该进程还不会结束,那么可以使用nohup命令。

该命令可以在你退出帐户/关闭终端之后继续运行相应的进程。nohup就是不挂起的意思( no hang up))

找台服务器 启动浏览器 输入 http://10.85.31.242:7001/console

WebLogic 12c下配置节点管理器管理受管理服务器 http://www.linuxidc.com/Linux/2015-12/126788.htm

WebLogic重新设置管理员账号和口令 http://www.linuxidc.com/Linux/2015-08/121052.htm

CentOS 6.3安装配置Weblogic 10  http://www.linuxidc.com/Linux/2014-02/96918.htm

Oracle WebLogic 11g 安装部署文档 PDF http://www.linuxidc.com/Linux/2013-04/83658.htm

Linux部署Weblogic11g http://www.linuxidc.com/Linux/2013-01/77940.htm

Oracle基础教程之安装与配置Weblogic单实例 http://www.linuxidc.com/Linux/2012-02/54418.htm

Linux下Weblogic卸载 http://www.linuxidc.com/Linux/2012-01/51886.htm

Weblogic多机器集群的配置 http://www.linuxidc.com/Linux/2011-12/50577.htm

Weblogic的安装和配置 http://www.linuxidc.com/Linux/2011-12/49082.htm

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

Apache2 https配置

vi /etc/apache2/sites-available/default-ssl.conf

1、添加证书信息

      SSLEngine on

      #   A self-signed (snakeoil) certificate can be created by installing

      #   the ssl-cert package. See

      #   /usr/share/doc/apache2/README.Debian.gz for more info.

      #   If both key and certificate are stored in the same file, only the

      #   SSLCertificateFile directive is needed.

  #     SSLCertificateFile      /etc/ssl/certs/ssl-cert-snakeoil.pem

  #     SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key

  SSLCertificateFile      /etc/letsencrypt/live/你的证书目录/fullchain.pem

  SSLCertificateKeyFile /etc/letsencrypt/live/你的证书目录/privkey.pem

2、运行命令a2enmod  ssl 开启SSL模块很重要 /关闭a2dismod ssl

3、运行命令a2ensite default-ssl.conf启用ssl站点很重要

4、重启Apache2或者 service apache2 reload

5、apachectl configtest   # 检查apache配置是否正确