Macetes para o Fedora 19
E ai galera aqui eu vou mostrar alguns macetes para a configuração do Fedora 19.
Ajustando o nome da máquina
Vamos ver como ajustamos o hostname da máquina
vim /etc/hostname fedora.douglasqsantos.com.br
Agora podemos sair da sessão e logar novamente ou podemos utilizar o comando hostname da seguinte forma
hostname fedora.douglasqsantos.com.br
Agora para consultar o nome utilizamos o comando hostname
hostname fedora.douglasqsantos.com.br
Parando e desabilitando o Firewall e desabilitando o SELinux
Vamos parar o firewall do Fedora
systemctl stop firewalld.service
Agora para desabilitar o firewall podemos fazer da seguinte forma
systemctl disable firewalld.service
Agora vamos desabilitar o SELinux
vim /etc/sysconfig/selinux # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=disabled # SELINUXTYPE= can take one of these two values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted
Configurações básicas de Rede
Vamos instalar o pacote que contem os comandos para manipulação da configuração de rede
yum install net-tools -y
Agora vamos ajustar a interface de rede, o nome dela vai mudar de acordo com o modelo
vim /etc/sysconfig/network-scripts/ifcfg-enp9s0 PEERROUTES="yes" IPV6INIT="yes" NAME="enp9s0" IPV6_PEERDNS="yes" DEFROUTE="yes" UUID="aab3f8a4-55af-4003-bee0-8ef064f18398" PEERDNS="yes" IPV4_FAILURE_FATAL="no" HWADDR="74:86:7A:F8:62:F1" #Precisamos mudar o bootproto de dhcp para static BOOTPROTO="static" IPV6_DEFROUTE="yes" IPV6_AUTOCONF="yes" IPV6_FAILURE_FATAL="no" TYPE="Ethernet" ONBOOT="yes" IPV6_PEERROUTES="yes" #Definição do IP IPADDR="192.168.0.20" #Definição da mascara de sub-rede NETMASK="255.255.255.0" #Definição do Gateway GATEWAY="192.168.0.1" #Definição do DNS1 DNS1="8.8.8.8" #Definição do DNS2 DNS2="8.8.4.4"
Agora vamos reiniciar NetworkManager para recarregar a nossa configuração
systemctl restart NetworkManager.service
Agora vamos consultar a nossa configuração
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 0 (Loopback Local) RX packets 112 bytes 8960 (8.7 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 112 bytes 8960 (8.7 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 p5p1: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 inet 192.168.1.20 netmask 255.255.255.0 broadcast 192.168.1.255 inet6 fe80::e84:dcff:fed5:8feb prefixlen 64 scopeid 0x20<link> ether 74:86:7a:f8:62:f1 txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 392569 bytes 42716681 (40.7 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Agora vamos conferir as rotas
route -n Tabela de Roteamento IP do Kernel Destino Roteador MáscaraGen. Opções Métrica Ref Uso Iface 0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 p5p1 192.168.1.0 0.0.0.0 255.255.255.0 U 9 0 0 p5p1
Trabalhando com serviços
Vamos listar todos os serviços do systemd
systemctl -t service UNIT LOAD ACTIVE SUB DESCRIPTION abrt-ccpp.service loaded active exited Install ABRT coredump hook abrt-oops.service loaded active running ABRT kernel log watcher abrt-xorg.service loaded active running ABRT Xorg log watcher abrtd.service loaded active running ABRT Automated Bug Reporting Tool accounts-daemon.service loaded active running Accounts Service alsa-state.service loaded active running Manage Sound Card State (restore and store) atd.service loaded active running Job spooling tools auditd.service loaded active running Security Auditing Service avahi-daemon.service loaded active running Avahi mDNS/DNS-SD Stack bluetooth.service loaded active running Bluetooth service chronyd.service loaded active running NTP client/server console-kit-daemon.service loaded active running Console Manager console-kit-log-system-start.service loaded active exited Console System Startup Logging crond.service loaded active running Command Scheduler dbus.service loaded active running D-Bus System Message Bus fedora-loadmodules.service loaded active exited Load legacy module configuration fedora-readonly.service loaded active exited Configure read-only root support getty@tty2.service loaded active running Getty on tty2 irqbalance.service loaded active running irqbalance daemon lightdm.service loaded active running Light Display Manager livesys-late.service loaded active exited SYSV: Late init script for live image. livesys.service loaded active exited LSB: Init script for live image. lvm2-lvmetad.service loaded active running LVM2 metadata daemon lvm2-monitor.service loaded active exited Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progress polling mcelog.service loaded active running Machine Check Exception Logging Daemon NetworkManager.service loaded active running Network Manager polkit.service loaded active running Authorization Manager rngd.service loaded failed failed Hardware RNG Entropy Gatherer Daemon rpcbind.service loaded active running RPC bind service rsyslog.service loaded active running System Logging Service rtkit-daemon.service loaded active running RealtimeKit Scheduling Policy Service sendmail.service loaded active running Sendmail Mail Transport Agent sm-client.service loaded active running Sendmail Mail Transport Client systemd-journald.service loaded active running Journal Service systemd-logind.service loaded active running Login Service systemd-readahead-collect.service loaded active exited Collect Read-Ahead Data systemd-readahead-replay.service loaded active exited Replay Read-Ahead Data systemd-remount-fs.service loaded active exited Remount Root and Kernel File Systems systemd-sysctl.service loaded active exited Apply Kernel Variables systemd-tmpfiles-setup.service loaded active exited Recreate Volatile Files and Directories systemd-udev-settle.service loaded active exited udev Wait for Complete Device Initialization systemd-udev-trigger.service loaded active exited udev Coldplug all Devices systemd-udevd.service loaded active running udev Kernel Device Manager systemd-user-sessions.service loaded active exited Permit User Sessions systemd-vconsole-setup.service loaded active exited Setup Virtual Console udisks2.service loaded active running Disk Manager upower.service loaded active running Daemon for power management vboxautostart-service.service loaded active exited LSB: VirtualBox autostart service vboxballoonctrl-service.service loaded active exited LSB: VirtualBox balloon control daemon vboxdrv.service loaded active exited LSB: VirtualBox Linux kernel module vboxweb-service.service loaded active exited LSB: VirtualBox web service API wpa_supplicant.service loaded active running WPA Supplicant daemon LOAD = Reflects whether the unit definition was properly loaded. ACTIVE = The high-level unit activation state, i.e. generalization of SUB. SUB = The low-level unit activation state, values depend on unit type. 52 loaded units listed. Pass --all to see loaded but inactive units, too. To show all installed unit files use 'systemctl list-unit-files'.
Podemos listar as possibilidades de serviços que já tem os seus arquivos no systemd
systemctl list-unit-files UNIT FILE STATE proc-sys-fs-binfmt_misc.automount static dev-hugepages.mount static dev-mqueue.mount static proc-fs-nfsd.mount static proc-sys-fs-binfmt_misc.mount static sys-fs-fuse-connections.mount static sys-kernel-config.mount static sys-kernel-debug.mount static tmp.mount static var-lib-nfs-rpc_pipefs.mount static cups.path enabled systemd-ask-password-console.path static systemd-ask-password-plymouth.path static systemd-ask-password-wall.path static abrt-ccpp.service enabled abrt-oops.service enabled abrt-pstoreoops.service disabled abrt-vmcore.service enabled abrt-xorg.service enabled abrtd.service enabled accounts-daemon.service enabled alsa-restore.service static alsa-state.service static alsa-store.service static anaconda-direct.service disabled anaconda-shell@.service static anaconda-sshd.service static anaconda-tmux@.service static anaconda.service static arp-ethers.service disabled atd.service enabled auditd.service enabled autovt@.service disabled avahi-daemon.service enabled blk-availability.service disabled bluetooth.service enabled brltty.service disabled canberra-system-bootup.service disabled canberra-system-shutdown-reboot.service disabled canberra-system-shutdown.service disabled chrony-wait.service disabled chronyd.service enabled colord.service static console-getty.service disabled console-kit-daemon.service disabled console-kit-log-system-restart.service static console-kit-log-system-start.service static [...]
Vamos parar um serviço como exemplo
systemctl stop sendmail.service
Agora para desabilitar um serviço podemos fazer da seguinte forma
systemctl disable sendmail.service rm '/etc/systemd/system/multi-user.target.wants/sm-client.service' rm '/etc/systemd/system/multi-user.target.wants/sendmail.service'
Agora para consultarmos o status de um serviço podemos fazer da seguinte forma
systemctl status lvm2-monitor.service lvm2-monitor.service - Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progress polling Loaded: loaded (/usr/lib/systemd/system/lvm2-monitor.service; enabled) Active: active (exited) since Qua 2013-10-02 19:39:14 BRT; 1h 19min ago Docs: man:dmeventd(8) man:lvcreate(8) man:lvchange(8) man:vgchange(8) Main PID: 203 (code=exited, status=0/SUCCESS) CGroup: name=systemd:/system/lvm2-monitor.service Out 02 19:39:13 localhost.localdomain lvm[203]: /dev/sr0: open failed: Mídi...a Out 02 19:39:14 localhost.localdomain lvm[203]: No volume groups found Out 02 19:39:14 localhost.localdomain systemd[1]: Started Monitoring of LVM2 ...
Para iniciar um serviço somente trocamos o status por um start
systemctl start atd.service
Em alguns casos vamos ter serviços no systemV dai vamos poder manipular com o chkconfig
Vamos listar os serviços da seguinte forma
chkconfig --list Nota: Esta saída mostra apenas os serviços SysV e não incluem os serviços nativos do systemd. Os dados de configuração do SysV podem ser apagados pela configuração nativa do systemd. Se você quiser listar os serviços do systemd, use o 'systemctl list-unit-files'. Para ver os serviços habilitados no alvo privado, use 'systemctl list-dependencies [target]' ebtables 0:não 1:não 2:não 3:não 4:não 5:não 6:não livesys 0:não 1:não 2:não 3:sim 4:sim 5:sim 6:não livesys-late 0:não 1:não 2:não 3:sim 4:sim 5:sim 6:não netconsole 0:não 1:não 2:não 3:não 4:não 5:não 6:não network 0:não 1:não 2:não 3:não 4:não 5:não 6:não vboxautostart-service 0:não 1:não 2:sim 3:sim 4:sim 5:sim 6:não vboxballoonctrl-service 0:não 1:não 2:sim 3:sim 4:sim 5:sim 6:não vboxdrv 0:não 1:não 2:sim 3:sim 4:sim 5:sim 6:não vboxweb-service 0:não 1:não 2:sim 3:sim 4:sim 5:sim 6:não
Agora para desabilitar um serviço podemos fazer da seguinte forma
chkconfig serviço off chkconfig --del serviço
Para habilitar um serviço podemos fazer da seguinte forma
chkconfig --add serviço
Ajustando os Repositórios mais rápidos
Agora vamos instalar o yum-plugin-fastestmirror que consegue identificar o repositório mais rápido
yum install yum-plugin-fastestmirror -y
Agora vamos mandar fazer um upgrade do sistema
yum update -y
Ajustando o teclado para ABNT2
Agora vamos ajustar o modelo do nosso teclado
vim /etc/vconsole.conf KEYMAP="br-abnt2" FONT="latarcyrheb-sun16"
Remover o Gnome 3 e instalar o MATE
Eu não sou nada fãn do Gnome 3 por isso estava procurando algo parecido com o Gnome 2 achei o MATE que é um fork do Gnome 2.
Para remover o Gnome 3 podemos fazer da seguinte forma esteja no modo texto para fazer isso.
yum remove @gnome-desktop -y
Depois de terminar de remover o gnome reinicie a máquina.
Agora vamos instalar o mate
yum install @mate-desktop -y
Agora é só reiniciar a máquina para utilizar o ambiente de Desktop
Como Instalar o VLC
Desabilite o repositório rpmforge caso esteja utilizando senão você vai ter conflitos
Agora vamos instalar o repositório necessário para o vlc
rpm -ivh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm
Agora precisamos mandar instalar o VLC
yum install vlc -y
Como Instalar o Skype no Fedora
Vamos obter o pacote do Skype
wget -c http://download.skype.com/linux/skype-4.2.0.11-fedora.i586.rpm
Agora vamos mandar instalar o Skype
yum install skype-4.2.0.11-fedora.i586.rpm -y
Aqui ele vai obter muitas dependências é só esperar :D
Instalação do repositório rpmforge
Agora vamos instalar o repositório
rpm -Uvh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
Agora é só instalar o que for necessário.
Instalando as ferramentas para desenvolvimento
Aqui vamos instalar as ferramentas para desenvolvimento que são compiladores, gerenciadores de versões e etc.
yum groupinstall "Development tools" -y
Instalando o VirtualBox
Vamos obter o Virtualbox
wget -c http://dlc.sun.com.edgesuite.net/virtualbox/4.2.18/VirtualBox-4.2-4.2.18_88780_fedora18-1.x86_64.rpm
Agora vamos instalar o Virtualbox
yum install VirtualBox-4.2-4.2.18_88780_fedora18-1.x86_64.rpm -y
Caso na instalação de algum erro sobre módulos do kernel precisamos instalar os kernel-headers e o kernel-devel
yum install kernel-headers kernel-devel -y
Caso o gcc não esteja instalado precisamos instalar ele ou caso tenha instalado o Development tools não vamos precisar instalar o gcc pois ele já vai estar instalado.
Após instalar as dependências precisamos mandar configura os módulos
/etc/init.d/vboxdrv setup
Agora vamos adicionar o usuário comum no grupo vboxusers para que ele possa mapear os dispositivos usb
gpasswd -a douglas vboxusers
Agora vamos obter o Virtualbox Extend
wget -c http://dlc.sun.com.edgesuite.net/virtualbox/4.2.18/Oracle_VM_VirtualBox_Extension_Pack-4.2.18-88780.vbox-extpack
Agora vamos instalar o VirtualBox Extension
VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.2.18-88780.vbox-extpack
Como Instalar o LibreOffice
Para instalar o LibreOffice é simples
yum install libreoffice -y
Caso já tenha instalado mais ele esteja com problemas podemos remove da seguinte forma
yum groupremove libreoffice -y
Depois mandar instalar novamente
yum install libreoffice -y