@torresdyl
2018-04-26T15:12:12.000000Z
字数 4957
阅读 1525
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.
# loginssh -l user1 192.168.0.100ssh user1@192.168.0.100# GUI appssh -X 192.168.0.100
ls -lacd ~user2 # if user1 have execetion bit on the pathtty # show terminal namewho # check /var/run/utmp to see who is logged in nowwho am i # check current user login infow # or `what`, is like `who am i`, with more detailsuptime # check uptime, system time, and how many users are logged inwhoami # show the current usernamelogname # show real username, even when `su`, it shows real namewhich cat # show what `cat` will be run if we don't specify an absolute path
idid shows UID, username, GID, group name, secondary groups and SELinux context.
> iduid=0(root) gid=0(root) groups=0(root),1004(admin),1005(rvm)> id westerngunuid=1000(westerngun) gid=1004(admin) groups=1004(admin),10(wheel),48(apache),1005(rvm)
groupsShows 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 lastblast 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 onlyuname -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.
hostnamectlStatic hostname: local_hostIcon name: computer-vmChassis: vmMachine ID: 5bb21648846848068840eee34f80c819Boot ID: 5a54d43a2efe44c28ab7c3ce9bfef00eVirtualization: vmwareOperating System: CentOS Linux 7 (Core)CPE OS Name: cpe:/o:centos:centos:7Kernel: Linux 3.10.0-693.2.2.el7.x86_64Architecture: x86-64
hostnamectl set-hostname xxx change hostname
hostname shows current name.
timedatectl # show detailstimedatectl set-time 2015-08-21 # change date. CAUTION: NOT `set-date`!timedatectl set-time 11:00date --set "2018-08-21 10:00" # set date and timetimedatectl list-timezones # list available timezonestimedatectl set-timezone Europe/Madrid # change timezone. No "" needed
wc: check file info
wc /etc/profile76 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 detailslsusb -v/-vv/-vvv # list USB buseslscpu # 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 filebzip2 -d xxx.bz2bunzip2 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 compressingtar cfv /tmp/new.tar file1 file2tar rvf /tmp/new.tar /etc/yum.repos.d # append the file to the tartar xvf /tmp/new.tar # extract the files in the tar in here (.)tar cvfz /tmp/new.tar.gz /home # archive and compress with gziptar cvfj /tmp/new.tar.bz2 /home # archive and compress with bzip2
Remember: first the tar file name, then the files to package!