@torresdyl
2018-04-26T23:12:12.000000Z
字数 4957
阅读 1297
rhel
redhat
test
Note: not required in exam
Richard Stallman: GNU(GNU's Not Unix project), 1991
Linus Torvalds: kernel, 1991
RHL: since 1994
RHEL 7: based on kernel 3.10 at first, 2014
100% rebuilds: CentOS and Scientific Linux
Anaconda: the installer. 3 modes: GUI, text, kickstart(for network installation, no user intervention)
KVM(kernel-based virtualization machine) is integrated into RHEL 7, to install virtual machines of Linux or Windows on RHEL 7.
RHEL 7 can be installed in network.
??? two key hardware requirements for a computer to use KVM
64 bit and support hardware virtualization.
6 virtual console screens, Ctrl+Alt+F1-F6
F1: main screen to choose language, and then changes to F6
F2: bash shell with root
F3: installation log info (/tmp/anaconda.log
)
F4: storage info (/tmp/storage.log
)
F5: program info (/tmp/lprogram.log
)
F6: default GUI installation console
log files: first created in /tmp
, then moved to `/var/log' after installation.
file names | what to do |
---|---|
/root/anaconda-ks.cfg | records of config |
/root/install.log | packages installed |
/root/install.log.syslog | general messages |
/var/log/anaconda*.log | other things |
/boot
must be created as a standard partition outside LVM. (xfs
file system, the LVM volume group is "standard partition"). /
, /home
if xfs
, LVM volume group is vg00
(customed name), and swap is of file system swap
, vg00
.
If we choose automatic partition, it will use LVM, and standard partition is not used.
the address can be changed during installation.
Objectives:
- shell, commands
- archive, compress, unpack, uncompress with tar
,star
, gzip
and bzip2
.
- text files
- man, info, and /user/share/doc
.
# login
ssh -l user1 192.168.0.100
ssh user1@192.168.0.100
# GUI app
ssh -X 192.168.0.100
ls -la
cd ~user2 # if user1 have execetion bit on the path
tty # show terminal name
who # check /var/run/utmp to see who is logged in now
who am i # check current user login info
w # or `what`, is like `who am i`, with more details
uptime # check uptime, system time, and how many users are logged in
whoami # show the current username
logname # show real username, even when `su`, it shows real name
which cat # show what `cat` will be run if we don't specify an absolute path
id
id
shows UID, username, GID, group name, secondary groups and SELinux context.
> id
uid=0(root) gid=0(root) groups=0(root),1004(admin),1005(rvm)
> id westerngun
uid=1000(westerngun) gid=1004(admin) groups=1004(admin),10(wheel),48(apache),1005(rvm)
groups
Shows in which group the user is in. The first group: primary group. The rest: secondary group(s).
> groups $(logname)
root : root admin rvm
> groups $(whoami)
westerngun : admin wheel apache rvm
last
and lastb
last
check /var/log/wtmp
to list all successful login attempts, system reboots.
last # list all users activities(login, logout)
last reboot # list reboots
lastb
checkss /var/log/btmp
and list all failed login attempts.
lastb # list all failed login
lastlog
list recent login users, and users never logined.
uname # system name only
uname -a # all details of system, like if it is 64 bit.
Linux local_ding 3.10.0-693.2.2.el7.x86_64 #1 SMP Tue Sep 12 22:26:13 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
hostnamectl
show hostname.
hostnamectl
Static hostname: local_host
Icon name: computer-vm
Chassis: vm
Machine ID: 5bb21648846848068840eee34f80c819
Boot ID: 5a54d43a2efe44c28ab7c3ce9bfef00e
Virtualization: vmware
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-693.2.2.el7.x86_64
Architecture: x86-64
hostnamectl set-hostname xxx
change hostname
hostname
shows current name.
timedatectl # show details
timedatectl set-time 2015-08-21 # change date. CAUTION: NOT `set-date`!
timedatectl set-time 11:00
date --set "2018-08-21 10:00" # set date and time
timedatectl list-timezones # list available timezones
timedatectl set-timezone Europe/Madrid # change timezone. No "" needed
wc
: check file info
wc /etc/profile
76 252 1795 /etc/profile
| | | |
| | | file name
| | bytes/characters counts(-c)
| word counts (-w)
line counts (-l)
lspci -v/-vv/-vvv/-m # list PCI buses and devices attached; with details
lsusb -v/-vv/-vvv # list USB buses
lscpu # list cpu info
tar
, gzip
, bzip2
are used to compress/uncompress files. tar
is for archiving, gzip
,bzip2
are to compress/uncompress.
gzip file1 file2 # will compress the two files in separate files
NOTE: this way will replace original files!! with .gz
extension! And compress!
To uncompress, run gunzip xxx.gz
or gzip -d xxx.gz
.
bzip2 xxx # will comrress the file and replace original file
bzip2 -d xxx.bz2
bunzip2 xxx.bz2 # will uncompress file and delete .bz2 file
tar
can archive files, preserving the attributes of files.
switch | meaning |
---|---|
-c | create a tarball |
-f | specify name |
-j | compress with bzip2 |
-z | compress with gzip |
-x | extract files |
-r | append file to a tarball. Not working with compressed tarball |
-t | list content |
-u | same as -r but only if the file to append is newer |
-v | verbose |
--selinux/--no-selinux | include/exclude SELinux file contexts |
--xattrs/--no-xattrs | include/exclude extended file attributes |
for example:
tar cfv /tmp/new.tar /home # archive files and save to /tmp/new.tar, without compressing
tar cfv /tmp/new.tar file1 file2
tar rvf /tmp/new.tar /etc/yum.repos.d # append the file to the tar
tar xvf /tmp/new.tar # extract the files in the tar in here (.)
tar cvfz /tmp/new.tar.gz /home # archive and compress with gzip
tar cvfj /tmp/new.tar.bz2 /home # archive and compress with bzip2
Remember: first the tar file name, then the files to package!