Tag Archives: linux

Methods of compiling and installing ffmpeg and libx264 in Linux

Recently in the study of TS stream video preparation FFMPEG video format encoding and conversion
Compiling FFMPEG was smooth but integrating with Libx264 was tedious
It took me a long time to find it online
It is hereby sorted here

Operating system: CentOS 6.4 64-bit kernel 2.6.32
Compiling environment: GCC 4.4.7
FFMPEG version: 2.4
X264 version: X264 0.142.2479 DD79A61
YASM version: 1.3

Prepare documents:
Ffmpeg source
https://www.ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
x264
Git clone git://git.videolan.org/x264.git
yasm
http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz

Compile and install procedure:
1. Install YASM

tar zxvf yasm-1.3.0.tar.gz 
cd yasm-1.3.0
 ./configure 
 make
 make install
 yasm --version

2. Compile and install X264

cd x264 
./configure --enable-shared --enable-pthread --enable-pic
make
make install

3. Compile FFMPEG

cd ffmpeg
./configure --enable-libx264 --enable-gpl --enable-shared  --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib --enable-pic
make
make install

Install well at FFMPEG runtime if prompted

ffmpeg: error while loading shared libraries: libavdevice.so.52: cannot open shared object file: No such file or directory

You will need to modify the file: /etc/ld.so.conf

Add a line at the end of the file:
/usr/local/lib
Then execute the command:
ldconfig

Rerun the ffmpeg – encoders | grep x264 will find successful installation

Solve the problem that CEPH dashboard cannot be accessed

Fixed Ceph Dashboard not accessible
Check which node the Dashboard is currently in.

[root@ceph02 ~]# ceph mgr services
{
    "dashboard": "https://ceph02:8443/"
}

Restart Dashboard in Ceph02 (restart on that node and restart on that node)

[root@ceph02 ~]# ceph mgr module  disable  dashboard
[root@ceph02 ~]# ceph mgr module  enable  dashboard

At this point the browser accesses
again

Centos 7.2 failed to load SELinux policy freezing

Adjust the SELINUX = permissive; A very serious problem is that the server cannot boot. The main error was to modify SELinuxType =disabled. Instead of changing SELinuxType =disabled, you should have changed SELinux because you were in a hurry and you changed it incorrectly. Cause unnecessary trouble.

The error is shown in the figure
https://img-my.csdn.net/uploads/201709/03/1504438099_6968.png

Solutions:

1. When rebooting the system, select the kernel you want to enter from the following page, and press E, grub to edit the page.
https://img-my.csdn.net/uploads/201709/03/1504438099_7830.png
2. Find linux16 that line in LANG = zh_CN. Utf-8 Spaces with selinux = 0 or enforcing = 0 (I was the first to solve the problem)
3. After that, Ctrl+ X will launch, and you will see the familiar page in a moment. On the other hand, you might be stuck on the page below for a while, but you’ll be fine later
https://img-my.csdn.net/uploads/201709/03/1504438100_7681.png
4. After entering the system, remember to modify the configuration correctly.
5. Modify the “SELinux” parameter in /etc/selinux/config file
# SELINUX = enforcing the original configuration
SELINUX = disabled correctly
   
But I was looking at the wrong modification; Modified the selinuxType parameter by treating “selinuxType =target” as “SELINUX”

# selinuxType =targeted The original configuration is unchanged
SELINUXTYPE = disabled errors

Failed to load SELinux policy. Freezing due to modification of SELinux by centos7

The reason for the error
Configuration closed SELinux, as a result, wrong operation, should be modified in the configuration file/etc/SELinux/config “SELinux” the value of the parameter, SELinux = enforcing original configuration SELinux = disabled right
but mistakenly “SELINUXTYPE” as “SELinux”, set up SELINUXTYPE parameters:
# SELINUXTYPE = targeted the original configuration This don’t need to modify.
SELINUXTYPE = disabled errors
Error
Failed to load SELinux policy. Freezing error caused the machine to never start
Solutions:

    When rebooting, on the boot page, select the kernel you want to boot and press E to enter the GRUB editing page. Find the linux16 one line, behind the language Is LANG = zh_CN. Utf-8, the blank space with selinux = 0 or enforcing = 0 (note: I am join selinux = 0 effect.) Then Ctrl + X launches, and you see the familiar login screen. Modify the SELinux configuration file to properly close SELinux ~! 4. Modify SELinux configuration file to properly close SELinux ~!

    vim /etc/selinux/config
    #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 three two values:
    #targeted – Targeted processes are protected,
    #minimum – Modification of targeted policy. Only selected processes are protected.
    #mls – Multi Level Security protection.
    SELINUXTYPE=targeted

After the modification is complete, restart. Check to see if an error is reported. Over.

After CentOS 7 starts, the login box cannot be displayed. Press Alt + F2 to display “failed to start authorization manager”

I can enter the CentOS selection screen, but then I can’t display the login box, which means I can’t log in to any account (my system is a graphical interface). If you press Alt +F2 or press the shutdown key, it will show “Failed to start Authorization Manager”.

I could not find a similar reason on the Internet. I considered that there might be a problem with a previous operation, so I entered Rescue mode
How (centos into rescue mode: https://www.youtube.com/watch?v=e-NauoY3m50& Feature = youtu. Be)

I previously put the /usr/lib64 folder below
/usr/lib64/libstdc++
/ home/zhexin/Software/GCC/GCC – 5.4.0 – build/x86_64 – unknown – – the gnu/Linux libstdc++ – v3/SRC/libs/libstdc++. So. 6.0.21,
In rescue mode, I copy libstdc++.so.6.0.21 to /usr/lib64/libstdc++.so.6 to libstdc++.
Be careful not to link files under root such as /usr/lib64 to a user directory.

Import / export. SQL file / gzip file for MySQL under Linux

    ready. SQL file and upload to server login server MySQL import. SQL file
If you need to create the database for the entire database file you don’t need to create the database for the table file
Source *.sql //.sql file path
 
3. Export. SQL file
Export table structure
It’s going to be in the data directory
cd /mysql/data/
. /bin/mysqldump -uroot -p -d newdb > Newdb.sql // newdb database name
// Enter the password
 
Export data and table structures
It’s going to be in the data directory
cd /mysql/bin/
. /bin/mysqldump -uroot -p newdb > Newdb.sql // newdb database name
// Enter the password
 

    exports the gzip file
It’s going to be in the data directory
. /bin/mysqldump -uroot -p –default-character-set=utf8 xw_taes | gzip > /home/xw_taes_1.sql.gz
// Enter the password
 

    import gzip
In any directory
gzip -d < /home/xw_taes_1.sql.gz | mysql -uroot -p xw_taes_1
// Enter the password
Xw_taes_1 is the name of the database to import
There is no meeting

 
Note: Adding plaintext password directly will report an error

The Linux terminal appears bash: setup.bash : no such file or directory, and. Bashrc file

Earlier in the Linux open a terminal, he always appear bash:/opt/ros/indig/setup. Bash: No to the file or directory. This problem is related to the bash that needs to be loaded every time the terminal is opened.

/etc/bashrc: This file sets up environment information for each user of the system and is executed when the user first logs in and collects shell Settings from the configuration file in the /etc/profile.d directory. This file is read when the bash shell is opened.
~/.bash_profile: Each user can use this file to enter specific shell information for his or her own use, and this file is executed only once when the user logs in! By default, it sets some environment variables and executes the user’s.bashrc file.
~/.bashrc: This file contains bash information specific to your bash shell, which is read when you log in and every time you open a new shell.
/.bash_logout: This file is executed every time you exit the system (exit the bash shell)
I turn to open the file, the last in ~ /. Bashrc found the last line of this file: the source/opt/ros/indig/setup. Bash the bash file does not exist in the file system, so I deleted it. After that, it works fine when you start the terminal again.
P.S. We can get through

echo "source /opt/ros/indigo/setup.bash" >> ~/.bashrc

Command to add a path to the.bashrc file.

Then through

source ~/.bashrc

Order to put it into effect.

Linux has no way to solve bash. / that file or directory

Running./ XXX in Ubuntu 64-bit will pop up saying there is no such file or directory, but ls will see this file again, which is very strange.
In fact, the reason is very simple, because he does not have the 32-bit runtime ia32-libs, just install it.
apt-get install ia32-libs
It is possible that XXX is referenced by another package, but the following package replaces it: lib32ncurses5 lib32z1
The method of zero:
sudo apt-get install g++-multilib
Method one:
http://pkgs.org/download/ia32-libs
download mint 17 deb software installation for the center line depends on what the solution automatically
Method 2:
Sudo DPKG –add-architecture i386
sudo apt-get update
do apt-get dist-upgrade
This step is used to install Wine, which may occur if the computer does not have Wine installed (in fact, it will prompt you to install it if it does not).
Method 3:
Apt-get-f install: apt-get-f install
Method 4:
See the solution for ubuntukylin.com WUY069
 
1. Switch to root
Sudo -i
2. Enter the APT source list
CD/etc/apt/sources. List. D
3. Add source for Ubuntu 13.04, since IA32-libs is deactivated in subsequent versions of 13.10
Echo “deb http://archive.ubuntu.com/ubuntu/ raring main restricted universe multiverse” & gt; ia32-libs-raring.list
 
4. Update the source and install IA32-LIBS
Apt to get the update
Apt to get the install ia32 libs
 
5. Restore the source
The rm ia32 libs – raring. List
Apt to get the update

Solve the problem of “bash. / don’t have that file or directory” in Ubuntu 64 bit

When you first run the./XXX file in Ubuntu 64-bit, you might say that bash doesn’t have that file or directory, but it does;
The reason is that there is no 32-bit runtime;

Solution:

$sudo apt-get install ia32-libs

If it says no packages are available, then install the alternative:

$sudo apt-get install libc6:i386 libgcc1:i386 gcc-4.6-base:i386 libstdc++5:i386 libstdc++6:i386

>

In Linux shell script, about the commonly used flag [- EQ, GT..] in test and if judgment

1. Determine the “document type” of a document, such as test-e filename whether it exists or not

-e Whether the “Document” exists (commonly used)

-f whether the “Document” exists and is a file (commonly used)

-d whether this “document” exists and is a directory (commonly used)

-b Whether the Document exists and is a Block Device

-c Whether this Document exists and is a Character Device

-s whether this “document” exists and is a Socket file

-p Whether the “Document” exists and is a FIFO (PIPE) file

-l Whether the Document exists and is a link file


-r checks if the document exists and has “readable” permissions

-w checks if the document exists and has the permission to be writable

-x checks if the document exists and has “executable” permissions

-u checks if the document name exists and has the property “SUID”

-g checks if the document name exists and has the attribute “SGID”

-k checks if the document name exists and has a “Sticky bit” property

-s checks if the document exists and is a “non-blank file”

>
>
>
>
>
>
>
>

-nt (newer than) determines whether file1 is newer than file2

-ot (older than) determines whether file1 is older than file2

-ef determines whether file1 and file2 are the same file, which can be used to determine the hard link. The key is to determine if both files point to the same inode

4. About the comparison between two integers, for example test n1 -eq n2

-Eq equals two values.

-Ne is not equal.

-gt n1 is greater than n2 (greater than)

-lt n1 is less than n2 (less than)

-e e n1 is greater than or equal to n2 (greater than or equal)

-le n1 is less than or equal to n2.

5

The test-z string determines if the string is empty and returns true for empty

Test-n string determines that the string is not null and returns false for null

= test -r filename -a-x filename
= test -r filename -a-x filename

– A (and) is both true! Test-r file-a-x file = test-r file-a-x file = test-r file-a-x file = test-r file-a-x file = test-r file-a-x file = test-r file-a-x file = test-r file-a-x file

-O (OR) Either is true! Test-r file-o-x file = test-r file-o-x file = test-r file-o-x file = test-r file-o-x file = test-r file-o-x file = test-r file-o-x file = test-r file-o-x file

! Inverse state, such as test! -x file. Returns true if file does not have x