Install MYSQL/MARIADB installation Gogs on CentOS

Source: Internet
Author: User
Tags chmod gpg gz file local time mysql version symlink install perl

Minimum installation: 1. Select English2. DATE & Time modified local software selection The default minimal install is good installation destination Select Then, Begin Installation3. Root password set the root password user creation set new users, tick make this user administrator wait for the installation to complete, click the Reboot button. Configure the static ipv4:$ systemctl status Networkmanager.service Check the Network Manager service status $ nmcli dev statusdevice TYPE State connectione NS33 Ethernet Disconnected--lo loopback unmanaged--Here you need to configure ens33$ su# cd/etc/sysconfig/network-scripts# ls ifcfg*# VI ifcfg-ens33 Configuration ens33 change Bootproto=dhcp to bootproto=static and add the following line: ipaddr=192.168.48.128netmask= 225.225.225.0nm_controlled=no change Onboot=no to Onboot=yes Save Exit VI (NM_CONTROLLED=NO indicates that the interface is set through this profile, Instead of through the network manager) Note: If you are using DHCP dynamic IP, simply change the onboot=no to Onboot=yes. # systemctl Restart netowrk.service# IP Add view IP information configuration CD for installation source (note: There is a configuration ISO for the installation source, here only the disc image is temporarily used as the installation source): $ sudo ssh 192.168.48.128- L root# Cat/etc/yum.repos.d/centos-media.repo Basic contents are as follows: [c7-media]name=centos-$releasever-mediabaseurl=file:///media /centos/file:///media/cdrom/       file:///media/cdrecorder/gpgcheck=1enabled=0gpgkey=file:///etc/pki/rpm-gpg/ The comment section of the rpm-gpg-key-centos-7 file header can be prompted with the command Yum--enablerepo=c7-media [command] or yum--disablerepo=\*--enablerepo=c7-media [command] to install the software. # ls/dev/cdrom# mkdir/media/cdrom# mount/dev/cdrom/media/cdrom Mount cdrom install vim, gcc, g++:# yum--disablerepo=\*-- Enablerepo=c7-media install vim-y# yum--disablerepo=\*--enablerepo=c7-media install gcc gcc-c++-y install MySQL 5.6: First Client and the server two RPM installation package is copied to the native download directory and then entered in the Mac Terminal: sudo scp ~/downloads/mysql-*.rpm [email protected]:/home/bob/ Copy the client and server installation files to the/home/bob/directory (note: You can also copy to another directory, such as [email protected]:/usr/local/) back to ssh:# rpm-qa|grep-i MARIADB query mariadb, conflict with MySQL, the following will be found in the library is forced to delete (minimum installation only mariadb-libs) # rpm-e--nodeps mariadb-libs# groupadd-r mysql# useradd- G MySQL mysql-d/home/mysql-s/sbin/nologin (note: The MySQL 5.7 forum installation sequence is: Common, libs, client, server) (note 2:mariadb 10.2 requires some dependency: Yum --disablerepo=\*--enablerepo=c7-media install lsof perl rsync boost perl-dbi-y then the installation sequence is: Galera, mariadb-10.2.10-centos73-x86_64-* (put in the same directory: Compat, Common, client, server)) # yum--disablerepo=\*--enablerepo=c7-media Install perl-y# rpm-ivh/mysql-client-5.6.34-1.el7.x86_64.rpm# yum--disablerepo=\*--enablerepo=c7-media Install autoconf-y# rpm-ivh./mysql-server-5.6.34-1.el7.x86_64.rpm# rm-f mysql-*.rpm# systemctl start Mysql.service (Note: MySQL 5. 7 startup service is Mysqld.service) (Note 2:mariadb 10.2 boot service is mysqld.service,mariadb) # Cat/root/.mysql_secret the random password Set for the root user at Tue 13:55:26 (local time): Vzqwdjlbxm_zhno_ (note: MySQL 5.7 initial password in log file $ grep "Tempor ary password "/var/log/mysqld.log then manually modify the security policy before calling Mysql_secure_installation: $ mysql-uroot-p mysql> Set Globa    L validate_password_policy=0;    mysql> set global validate_password_length=0; Mysql> exit or edit/etc/my.cnf [mysqld] validate_password=off) (note 2:mariadb 10.2 does not have an initial password, you can set the password to 123456/us by the following command r/bin/mysqladmin-u root password ' 123456 ') #/usr/bin/mysql_secure_installation paste the random password intoPrompt, change the root password, remove the anonymous account, disable root telnet, remove the test database, and refresh the permissions, as prompted. (Note: MySQL 5.7 after the previous password policy has been set, you may have to enter a simple password to confirm) # Mysql-uroot-p Create a new user:mysql> the '%1 ' @ '% ' identified by ' 123456 ';( If the root account is connected remotely:mysql> grant all privileges on * * to ' root ' @ '% ' identified by ' 123456 ';) mysql> flush Privileges;mysql > exit# firewall-cmd--zone=public--add-port=3306/tcp--permanent# firewall-cmd--reload------mysql emoji------ Note: The minimum MySQL version of UTF8MB4 supports version 5.5.3+ if you specify UTF8MB4 and utf8mb4_general_ci when you create databases, tables, and columns, the following should not be set. 1) Set my.cnf$ sudo vim/etc/my.cnf (ubuntu location/etc/mysql/my.cnf) [Client]default-character-set=utf8mb4[mysql] Default-character-set=utf8mb4[mysqld]character-set-client-handshake=falsecharacter-set-server= utf8mb4collation-server=utf8mb4_unicode_ciinit_connect= ' SET NAMES utf8mb4 ' skip-name-resolve save after restart mysql$ systemctl Restart mysql$ mysql-uroot-pmysql> SHOW VARIABLES WHERE variable_name like ' character_set_% ' OR variable_name like ' C ollation% '; +--------------------------+----------------------------+| VariAble_name | Value |+--------------------------+----------------------------+| character_set_client | UTF8MB4 | | character_set_connection | UTF8MB4 | | Character_set_database | UTF8MB4 | | Character_set_filesystem | binary | | Character_set_results | UTF8MB4 | | Character_set_server | UTF8MB4 | | Character_set_system | UTF8 | | Character_sets_dir | /usr/share/mysql/charsets/| | collation_connection | Utf8mb4_general_ci | | Collation_database | Utf8mb4_unicode_ci | | Collation_server | Utf8mb4_unicode_ci |+--------------------------+----------------------------+11 rows in Set note: Collation_connection, Collation_database, Collation_server is utf8mb4_general_ci no relationship. 2) Modify the database, Table, column character set: ALTER database database_name CHARACTER set = UTF8MB4 COLLATE = utf8mb4_unicode_ci;ALTER TABLE table_name CONVERT to CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;  ALTER Table table_name Change column_name VARCHAR (191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; fix optimization table repair tables Table_name;optimize TABLE table_name; You can also optimize all databases with the Mysqlcheck command $ mysqlcheck-uroot-p--auto-repair--optimize-- ALL-DATABASES3) for Java, the MySQL connector version needs to be higher than 5.1.13. Install Gogs: First copy the Linux_amd64.zip package to the native download directory, and then enter on the Mac Terminal: sudo scp ~/downloads/linux_amd64.tar.gz [email protected]:/ root/Copy the linux_amd64.tar.gz file to the/root/directory (note: can also be copied to another directory, such as [email protected]:/usr/local/] back to ssh:# groupadd-r git# Useradd-g git git-d/home/git# mv/root/linux_amd64.tar.gz/home/git/# chown git:git/home/git/linux_amd64.tar.gz (if Zi  P File: Yum--disablerepo=\*--enablerepo=c7-media install unzip-y) # su git$ cd ~$ tar xvfz linux_amd64.tar.gz (if it is a zip file: Unzip Linux_amd64.zip) $ lsgogs linux_amd64.tar.gz$ rm-f linux_amd64.tar.gz$ cd gogs$ chmod +x./gogs$ Cat./scripts/mysql.sql DROP DATABASE IF EXISTS gogs; CREATE DATABASE IF not EXISTS gogs CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;$ mysql-uroot-p < scripts/mysql.sql$ Mysql-uroo T-pmysql> grant all privileges on gogs.* to ' Bob ' @ '% ' identified by ' 123456 ';mysql> flush privileges;mysql> exit $ exit# cp/home/git/gogs/scripts/systemd/gogs.service/etc/systemd/system/# cat/etc/systemd/system/gogs.service[ Unit]description=gogsafter=syslog.targetafter=network.targetafter=mariadb.service Mysqld.service  Postgresql.service Memcached.service redis.service[service]# Modify These the values and uncomment them if you have# repos With lots of files and get an HTTP error because# of that### #LimitMEMLOCK =infinity#limitnofile=65535type=simpleuser=g Itgroup=gitworkingdirectory=/home/git/gogsexecstart=/home/git/gogs/gogs Webrestart=alwaysenvironment=user=git Home=/home/git[install]wantedby=multi-user.target Start Service, configure Firewall # SYSTEMCTL start gogs.service# systemctl enable gogs.service# firewall-cmd--zone=public--add-port=3000/tcp--permanent# firewall-CMD--reload (Ubuntu system Configuration Firewall command: sudo ufw allow (sudo ufw enable) and then open http://192.168.48.128:3000 in the browser (note 2:MARIADB is configured well, Host may not be able to connect with 127.0.0.1, please use host ip:192.168.48.128) Note: If SELinux is turned on, it may need to be turned off. # vim/etc/sysconfig/selinux changing Selinux=enforce to Disabled requires a reboot. Unable to use SSH for clone and push data if the HTTP mode is no problem, the Gogs account (this is a git account) does not specify the shell, the workaround is: # cat/etc/shells/bin/sh/bin/bash...# Usermod-s/bin/bash git upgrade gogs$ sudo service gogs stop$ sudo su-git$ cd ~$ pwd/home/git$ lsgogs gogs-repositories$ MV Go GS gogs_old$ wget https://dl.gogs.io/gogs_v$version_$os_$arch.tar.gz$ tar-zxvf gogs_v$version_$os_$arch.tar.gz$ Lsgogs gogs_old gogs-repositories gogs_v$version_$os_$arch.tar.gz$ cp-r gogs_old/custom gogs$ cp-r gogs_old/data gogs$ C P-r gogs_old/log gogs$ sudo service gogs start if startup fails, there may be a problem with permissions: # chmod +x/home/git/gogs/gogs# chown-r git:git/home/git/ gogs# Service gogs start--------------------------sudo$ su# vim/etc/sudoers Add the same line after Root all= (all), the root of the new row is changed to the current user, Then w! write, Exit vim# exit$ on it. Boot to command line interface Graphical.target toMulti-user.target $ systemctl get-default graphical.target$ sudo systemctl set-default multi-user.target Removed symlink /etc/systemd/system/default.target.created symlink From/etc/systemd/system/default.target to/usr/lib/systemd/ system/multi-user.target.$ sudo reboot//boot to graphical desktop$ startx change ownership chown-r Youruser:youruser/home/youruser /* Replace shell# cat/etc/shells# echo $SHELL # usermod-s/sbin/nologin youruser# usermod-s/sbin/bash youruser set ISO as installation Source view URL # IP Add remote copy $ SCP ~/desktop/centos-7-x86_64-everything-1611.iso [email protected]:/usr/local/telnet $ ssh 192.168.48.128-l root Move file to/usr/local/iso# mkdir/usr/local/iso# Mv/usr/local/centos-7-x86_64-everything-1611.iso/ usr/local/iso/Modify Fstab, hang ISO to/mnt/centiso# vi/etc/fstab append:/usr/local/iso/centos-7-x86_64-everything-1611.iso/mnt /centiso iso9660 defaults,ro,loop 0 0 Create mount point and Mount: # mkdir/mnt/centiso# mount-a# ls/mnt/centisocentos_buildtag EFI EULA G PL images isolinux LiveOS Packages repodata rpm-gpg-key-centos-7 rpm-gpg-key-centos-testing-7 TRANS.    TBL remembers this Gpg-key file that will be used on the Yum configuration source to view the Yum source # Ls/etc/yum.repos.d/centos-base.repo Centos-debuginfo.repo Centos-media.repo Centos-vault.repocentos-cr.repo Centos-fasttrack.repo Centos-sources.repo A new cdrom.repo# VI cdrom.repo[CDROM]name= Centisobaseurl=file:///mnt/centisoenabled=1gpgcheck=0gkgkey=file///mnt/centiso/rpm-gpg-key-centos-7 checking the installation source # Yum List gccloaded Plugins:fastestmirrorcdrom | 3.6 KB 00:00base | 3.6 KB 00:00 ... you can see CDROM installation source installation vim# Yum install vim

Install MYSQL/MARIADB installation Gogs on CentOS

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.